Spaces:
Running
Running
Update tasks/text.py
Browse files- tasks/text.py +16 -16
tasks/text.py
CHANGED
@@ -62,22 +62,22 @@ async def evaluate_text(request: TextEvaluationRequest):
|
|
62 |
|
63 |
#--------------------------------------------------------------------------------------------
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
#predictions = xgb.predict(embeddings)
|
82 |
|
83 |
|
|
|
62 |
|
63 |
#--------------------------------------------------------------------------------------------
|
64 |
|
65 |
+
"""""#load
|
66 |
+
# Step 1: Use Sentence-BERT to convert text to embeddings
|
67 |
+
model = SentenceTransformer("dunzhang/stella_en_400M_v5",trust_remote_code=True,
|
68 |
+
device="cpu",
|
69 |
+
config_kwargs={"use_memory_efficient_attention": False, "unpad_inputs": False})
|
70 |
+
|
71 |
+
# Convert each sentence into a vector representation (embedding)
|
72 |
+
embeddings = model.encode(test_dataset['quote'])
|
73 |
+
# YOUR MODEL INFERENCE CODE HERE
|
74 |
+
# Update the code below to replace the random baseline by your model inference within the inference pass where the energy consumption and emissions are tracked.
|
75 |
+
#--------------------------------------------------------------------------------------------
|
76 |
+
|
77 |
+
#load model
|
78 |
+
with open("stella_400_xgb_500.pkl","rb") as f:
|
79 |
+
xgb = pickle.load(f)
|
80 |
+
"""""
|
81 |
#predictions = xgb.predict(embeddings)
|
82 |
|
83 |
|