Skip to content

Commit

Permalink
Fix trust_remote_code (huggingface#1493)
Browse files Browse the repository at this point in the history
  • Loading branch information
astachowiczhabana authored and Luca-Calabria committed Nov 25, 2024
1 parent 3d5fd95 commit 4d4a301
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/text-generation/run_lm_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ def main():
args = setup_lm_eval_parser()
model, _, tokenizer, generation_config = initialize_model(args, logger)

if args.trust_remote_code:
# trust_remote_code fix was introduced in lm_eval 0.4.3
# https://github.com/EleutherAI/lm-evaluation-harness/pull/1998/files
# We need to cherry-pick the fix manually untill we upgrade (SW-190418)
import datasets

datasets.config.HF_DATASETS_TRUST_REMOTE_CODE = True

lm_tasks = lm_eval.tasks.get_task_dict(args.tasks)
with torch.no_grad():
lm = HabanaModelAdapter(tokenizer, model, args, generation_config)
Expand Down

0 comments on commit 4d4a301

Please sign in to comment.