Skip to content

Commit

Permalink
fix trust_remote_code issur
Browse files Browse the repository at this point in the history
Signed-off-by: changwangss <[email protected]>
  • Loading branch information
changwangss committed Jun 18, 2024
1 parent 634537a commit b052f7e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion evals/evaluation/lm_evaluation_harness/accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def cli_evaluate(args) -> None:
eval_logger.setLevel(getattr(logging, f"{args.verbosity}"))
eval_logger.info(f"Verbosity set to {args.verbosity}")
os.environ["TOKENIZERS_PARALLELISM"] = "false"
os.environ["HF_DATASETS_TRUST_REMOTE_CODE"] = "1"

if args.predict_only:
args.log_samples = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(
dtype: Optional[Union[str, torch.dtype]] = "auto",
batch_size: Optional[Union[int, str]] = 1,
max_batch_size: Optional[int] = 64,
trust_remote_code: Optional[bool] = False,
trust_remote_code: Optional[bool] = True,
use_fast_tokenizer: Optional[bool] = True,
add_bos_token: Optional[bool] = False,
prefix_token_id: Optional[int] = None,
Expand Down
11 changes: 9 additions & 2 deletions tests/test_lm_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ def test_lm_eval(self):
user_model = AutoModelForCausalLM.from_pretrained(model_name_or_path)
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
args = LMEvalParser(
model="hf", user_model=user_model, tokenizer=tokenizer, tasks="piqa", device="cpu", batch_size=1, limit=5
model="hf",
user_model=user_model,
tokenizer=tokenizer,
tasks="lambada_openai",
device="cpu",
batch_size=1,
limit=5,
trust_remote_code=True,
)
results = evaluate(args)
self.assertEqual(results["results"]["piqa"]["acc,none"], 0.6)
self.assertEqual(results["results"]["lambada_openai"]["acc,none"], 0.6)


if __name__ == "__main__":
Expand Down

0 comments on commit b052f7e

Please sign in to comment.