Skip to content

Commit

Permalink
upgrade lm_eval to 0.4.5 (#6561)
Browse files Browse the repository at this point in the history
Pull Request resolved: #6533


We have been using a pretty old `lm_eval` version. This is blocking us from upgrading other libraries like `transformers` and blocking some others work. For example, #6489.

In newer versions `lm_eval`, `pretrainedModel` becomes a required parameter. In 0.4.2, it defaults to `gpt2` if not provided. This PR upgrades our `lm_eval` version to the latest version 0.4.5 and set `pretrainedModel` to its original default value `gpt2`.

Differential Revision: [D65079913](https://our.internmc.facebook.com/intern/diff/D65079913/)
ghstack-source-id: 250754584

Co-authored-by: Lunwen He <[email protected]>
  • Loading branch information
pytorchbot and helunwencser authored Oct 30, 2024
1 parent 9481858 commit f0463c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion examples/models/llama/evaluate/eager_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
use_kv_cache: bool = False,
):
device = "cuda" if torch.cuda.is_available() else "cpu"
super().__init__(device=device)
super().__init__(device=device, pretrained="gpt2")
self._model = model
self._tokenizer = tokenizer
self._device = torch.device(device)
Expand All @@ -47,6 +47,10 @@ def eot_token_id(self):
return self._tokenizer.eot_id
return self._tokenizer.eos_id

@property
def prefix_token_id(self):
return self.eot_token_id

@property
def max_length(self):
return self._max_seq_length
Expand Down
2 changes: 1 addition & 1 deletion examples/models/llama/install_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pip install --no-use-pep517 "git+https://github.com/pytorch/ao.git@${TORCHAO_VER

# Install lm-eval for Model Evaluation with lm-evalution-harness
# Install tiktoken for tokenizer
pip install lm_eval==0.4.2
pip install lm_eval==0.4.5
pip install tiktoken blobfile

# Call the install helper for further setup
Expand Down

0 comments on commit f0463c4

Please sign in to comment.