Fresh start: safe version with token moved to env secret
Browse files- train_abuse_model.py +4 -1
train_abuse_model.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
# # Install core packages
|
2 |
# !pip install -U transformers datasets accelerate
|
|
|
3 |
|
4 |
# Python standard + ML packages
|
5 |
import pandas as pd
|
@@ -129,12 +130,14 @@ def evaluate_model_with_thresholds(trainer, test_dataset):
|
|
129 |
"pred_labels": final_pred_str
|
130 |
}
|
131 |
|
|
|
132 |
|
133 |
# Load dataset from Hugging Face Hub
|
134 |
path = hf_hub_download(
|
135 |
repo_id="rshakked/abusive-relashionship-stories",
|
136 |
filename="Abusive Relationship Stories - Technion & MSF.xlsx",
|
137 |
-
repo_type="dataset"
|
|
|
138 |
)
|
139 |
df = pd.read_excel(path)
|
140 |
|
|
|
1 |
# # Install core packages
|
2 |
# !pip install -U transformers datasets accelerate
|
3 |
+
import os
|
4 |
|
5 |
# Python standard + ML packages
|
6 |
import pandas as pd
|
|
|
130 |
"pred_labels": final_pred_str
|
131 |
}
|
132 |
|
133 |
+
token = os.environ.get("HF_TOKEN") # Reads my token from a secure hf secret
|
134 |
|
135 |
# Load dataset from Hugging Face Hub
|
136 |
path = hf_hub_download(
|
137 |
repo_id="rshakked/abusive-relashionship-stories",
|
138 |
filename="Abusive Relationship Stories - Technion & MSF.xlsx",
|
139 |
+
repo_type="dataset",
|
140 |
+
use_auth_token= token
|
141 |
)
|
142 |
df = pd.read_excel(path)
|
143 |
|