Spaces:
Sleeping
Sleeping
Update run_eval.py
Browse files- run_eval.py +10 -2
run_eval.py
CHANGED
@@ -3,7 +3,7 @@ import datetime, os, subprocess, tempfile
|
|
3 |
from pathlib import Path
|
4 |
|
5 |
import pandas as pd, yaml, torch
|
6 |
-
from huggingface_hub import HfApi, login, hf_hub_download
|
7 |
from lm_eval import evaluator
|
8 |
from lm_eval.models.huggingface import HFLM
|
9 |
from peft import PeftModel
|
@@ -62,7 +62,15 @@ for cfg in CONFIGS:
|
|
62 |
use_safetensors=True
|
63 |
)
|
64 |
is_encoder = True
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
peft_model = PeftModel.from_pretrained(base_model, adapter_repo)
|
67 |
merged_model = peft_model.merge_and_unload()
|
68 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
3 |
from pathlib import Path
|
4 |
|
5 |
import pandas as pd, yaml, torch
|
6 |
+
from huggingface_hub import HfApi, login, hf_hub_download, model_info
|
7 |
from lm_eval import evaluator
|
8 |
from lm_eval.models.huggingface import HFLM
|
9 |
from peft import PeftModel
|
|
|
62 |
use_safetensors=True
|
63 |
)
|
64 |
is_encoder = True
|
65 |
+
try:
|
66 |
+
info = model_info(adapter_repo)
|
67 |
+
files = [f.rfilename for f in info.siblings]
|
68 |
+
if "adapter_config.json" not in files:
|
69 |
+
print(f"{adapter_repo} is not a valid PEFT adapter (missing adapter_config.json)")
|
70 |
+
continue # skip
|
71 |
+
except Exception as e:
|
72 |
+
print(f"Failed to inspect {adapter_repo}: {e}")
|
73 |
+
continue
|
74 |
peft_model = PeftModel.from_pretrained(base_model, adapter_repo)
|
75 |
merged_model = peft_model.merge_and_unload()
|
76 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|