Neo-X commited on
Commit ·
7c5aae3
1
Parent(s): dcd683c
REmove model removal name.
Browse files
app.py
CHANGED
|
@@ -55,10 +55,10 @@ def evaluate_policy(model_id):
|
|
| 55 |
cfg = OmegaConf.load(hydra_config_file_path)
|
| 56 |
cfg.dataset.load_dataset = "skip"
|
| 57 |
cfg.testing = True
|
| 58 |
-
## load the GRP model from the file
|
| 59 |
# Dynamically load the module
|
| 60 |
import importlib.util, sys
|
| 61 |
-
sys.path.insert(0, repo_path+"/") ## dangerous for
|
| 62 |
from grp_model import GRP
|
| 63 |
|
| 64 |
model_ = torch.load(model_file, pickle_module=dill)
|
|
@@ -70,7 +70,7 @@ def evaluate_policy(model_id):
|
|
| 70 |
|
| 71 |
tokenizer = None
|
| 72 |
text_model = None
|
| 73 |
-
## Time the
|
| 74 |
start_time = time.time()
|
| 75 |
if cfg.dataset.encode_with_t5: ## Load T5 model
|
| 76 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
|
@@ -173,13 +173,13 @@ def run_evaluation_loop():
|
|
| 173 |
)
|
| 174 |
|
| 175 |
# Save Requests Updates to Hub
|
| 176 |
-
requests_df.to_csv("requests.csv", index=False)
|
| 177 |
-
api.upload_file(
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
)
|
| 183 |
|
| 184 |
return f"Processed {model_id}: Score {score}"
|
| 185 |
|
|
|
|
| 55 |
cfg = OmegaConf.load(hydra_config_file_path)
|
| 56 |
cfg.dataset.load_dataset = "skip"
|
| 57 |
cfg.testing = True
|
| 58 |
+
## load the GRP model from the file downloaded in the snapshot
|
| 59 |
# Dynamically load the module
|
| 60 |
import importlib.util, sys
|
| 61 |
+
sys.path.insert(0, repo_path+"/") ## dangerous for security but ok for now.
|
| 62 |
from grp_model import GRP
|
| 63 |
|
| 64 |
model_ = torch.load(model_file, pickle_module=dill)
|
|
|
|
| 70 |
|
| 71 |
tokenizer = None
|
| 72 |
text_model = None
|
| 73 |
+
## Time the evaluation run
|
| 74 |
start_time = time.time()
|
| 75 |
if cfg.dataset.encode_with_t5: ## Load T5 model
|
| 76 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
|
|
|
| 173 |
)
|
| 174 |
|
| 175 |
# Save Requests Updates to Hub
|
| 176 |
+
# requests_df.to_csv("requests.csv", index=False)
|
| 177 |
+
# api.upload_file(
|
| 178 |
+
# path_or_fileobj="requests.csv",
|
| 179 |
+
# path_in_repo="requests.csv",
|
| 180 |
+
# repo_id=REQUESTS_DATASET,
|
| 181 |
+
# repo_type="dataset"
|
| 182 |
+
# )
|
| 183 |
|
| 184 |
return f"Processed {model_id}: Score {score}"
|
| 185 |
|