Update
Browse files- .gitattributes +2 -0
- config.json +20 -0
- inference.py +37 -37
- model.pkl +1 -1
- vectorizer.pkl +1 -1
.gitattributes
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
model.pkl filter=lfs diff=lfs merge=lfs -text
|
2 |
+
vectorizer.pkl filter=lfs diff=lfs merge=lfs -text
|
config.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": ["AutoModelForSequenceClassification", "AutoModelForCausalLM"],
|
3 |
+
"model_type": "bert",
|
4 |
+
"classification_model_name": "delineiro/soflexpoc",
|
5 |
+
"generation_model_name": "delineiro/soflexpoc",
|
6 |
+
"language": "es",
|
7 |
+
"max_position_embeddings": 512,
|
8 |
+
"num_attention_heads": 12,
|
9 |
+
"num_hidden_layers": 12,
|
10 |
+
"pad_token_id": 0,
|
11 |
+
"vocab_size": 30522,
|
12 |
+
"hidden_size": 768,
|
13 |
+
"intermediate_size": 3072,
|
14 |
+
"hidden_act": "gelu",
|
15 |
+
"hidden_dropout_prob": 0.1,
|
16 |
+
"attention_probs_dropout_prob": 0.1,
|
17 |
+
"max_length": 100,
|
18 |
+
"do_sample": true,
|
19 |
+
"num_return_sequences": 1
|
20 |
+
}
|
inference.py
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
import joblib
|
2 |
-
import numpy as np
|
3 |
-
|
4 |
-
# Cargar el vectorizador
|
5 |
-
try:
|
6 |
-
with open('vectorizer.pkl', 'rb') as f:
|
7 |
-
vectorizer = joblib.load(f)
|
8 |
-
except Exception as e:
|
9 |
-
print(f"Error al cargar el vectorizador: {e}")
|
10 |
-
|
11 |
-
# Cargar el modelo
|
12 |
-
try:
|
13 |
-
with open('model.pkl', 'rb') as f:
|
14 |
-
model = joblib.load(f)
|
15 |
-
except Exception as e:
|
16 |
-
print(f"Error al cargar el modelo: {e}")
|
17 |
-
|
18 |
-
def preprocess(text):
|
19 |
-
"""Preprocesa el texto para la inferencia."""
|
20 |
-
try:
|
21 |
-
return vectorizer.transform([text])
|
22 |
-
except Exception as e:
|
23 |
-
print(f"Error en el preprocesamiento: {e}")
|
24 |
-
|
25 |
-
def predict(text):
|
26 |
-
"""Realiza la predicción a partir del texto ingresado."""
|
27 |
-
try:
|
28 |
-
X = preprocess(text)
|
29 |
-
return model.predict(X)
|
30 |
-
except Exception as e:
|
31 |
-
print(f"Error en la predicción: {e}")
|
32 |
-
|
33 |
-
if __name__ == "__main__":
|
34 |
-
# Prueba del modelo
|
35 |
-
test_text = "Texto de prueba para predecir"
|
36 |
-
result = predict(test_text)
|
37 |
-
print(f"Predicción: {result}")
|
|
|
1 |
+
import joblib
|
2 |
+
import numpy as np
|
3 |
+
|
4 |
+
# Cargar el vectorizador
|
5 |
+
try:
|
6 |
+
with open('vectorizer.pkl', 'rb') as f:
|
7 |
+
vectorizer = joblib.load(f)
|
8 |
+
except Exception as e:
|
9 |
+
print(f"Error al cargar el vectorizador: {e}")
|
10 |
+
|
11 |
+
# Cargar el modelo
|
12 |
+
try:
|
13 |
+
with open('model.pkl', 'rb') as f:
|
14 |
+
model = joblib.load(f)
|
15 |
+
except Exception as e:
|
16 |
+
print(f"Error al cargar el modelo: {e}")
|
17 |
+
|
18 |
+
def preprocess(text):
|
19 |
+
"""Preprocesa el texto para la inferencia."""
|
20 |
+
try:
|
21 |
+
return vectorizer.transform([text])
|
22 |
+
except Exception as e:
|
23 |
+
print(f"Error en el preprocesamiento: {e}")
|
24 |
+
|
25 |
+
def predict(text):
|
26 |
+
"""Realiza la predicción a partir del texto ingresado."""
|
27 |
+
try:
|
28 |
+
X = preprocess(text)
|
29 |
+
return model.predict(X)
|
30 |
+
except Exception as e:
|
31 |
+
print(f"Error en la predicción: {e}")
|
32 |
+
|
33 |
+
if __name__ == "__main__":
|
34 |
+
# Prueba del modelo
|
35 |
+
test_text = "Texto de prueba para predecir"
|
36 |
+
result = predict(test_text)
|
37 |
+
print(f"Predicción: {result}")
|
model.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 7103071
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6566d630fd91a6406a0b60465fd1941d1a475655c53088aeae71e38c4662515d
|
3 |
size 7103071
|
vectorizer.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 1123551
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e74c46f64f2513cc152fc1751b0fa1d8cb0015576b800a7ec4d3ded27b490bb6
|
3 |
size 1123551
|