Spaces:
Sleeping
Sleeping
same device for evaluate between model and input
Browse files
qwen_classifier/evaluate.py
CHANGED
@@ -83,7 +83,6 @@ def _preprocessing(df):
|
|
83 |
|
84 |
# Concatenate the encoded tags with the original DataFrame
|
85 |
df = pd.concat([df, encoded_df], axis=1)
|
86 |
-
print(df.columns)
|
87 |
texts = df["prob_desc_description"].values.tolist()
|
88 |
labels = df[TAG_NAMES].values.tolist()
|
89 |
|
@@ -136,7 +135,8 @@ def _evaluate_local(test_data_path, hf_repo):
|
|
136 |
|
137 |
with torch.no_grad():
|
138 |
for batch in dataloader:
|
139 |
-
|
|
|
140 |
labels = batch["labels"].type(torch.float32)
|
141 |
|
142 |
logits = global_model(batch["input_ids"], batch["attention_mask"])
|
|
|
83 |
|
84 |
# Concatenate the encoded tags with the original DataFrame
|
85 |
df = pd.concat([df, encoded_df], axis=1)
|
|
|
86 |
texts = df["prob_desc_description"].values.tolist()
|
87 |
labels = df[TAG_NAMES].values.tolist()
|
88 |
|
|
|
135 |
|
136 |
with torch.no_grad():
|
137 |
for batch in dataloader:
|
138 |
+
print(f"EVALUATION RUNNING ON {global_model.device}")
|
139 |
+
batch = {k: v.to(global_model.device) for k, v in batch.items()}
|
140 |
labels = batch["labels"].type(torch.float32)
|
141 |
|
142 |
logits = global_model(batch["input_ids"], batch["attention_mask"])
|