Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Llama3.1 model requires transformers==4.31.0 and current NxD llama3 test case is not compatible with the version. #40

Open
KeitaW opened this issue Jan 26, 2025 · 1 comment

Comments

@KeitaW
Copy link

KeitaW commented Jan 26, 2025

Llama example in NxD installs transformers==4.31.0 (ref) but that version of transformers cannot load Meta-Llama-3.1-70B.

from transformers import AutoTokenizer, AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("/fsx/ubuntu/Meta-Llama-3.1-70B")

causes

  File "/fsx/ubuntu/aws_neuron_venv_pytorch/lib/python3.8/site-packages/transformers/models/auto/configuration_auto.py", line 999, in from_pretrained
    return config_class.from_dict(config_dict, **unused_kwargs)
  File "/fsx/ubuntu/aws_neuron_venv_pytorch/lib/python3.8/site-packages/transformers/configuration_utils.py", line 744, in from_dict
    config = cls(**config_dict)
  File "/fsx/ubuntu/aws_neuron_venv_pytorch/lib/python3.8/site-packages/transformers/models/llama/configuration_llama.py", line 145, in __init__
    self._rope_scaling_validation()
  File "/fsx/ubuntu/aws_neuron_venv_pytorch/lib/python3.8/site-packages/transformers/models/llama/configuration_llama.py", line 163, in _rope_scaling_validation
    raise ValueError(
ValueError: `rope_scaling` must be a dictionary with with two fields, `name` and `factor`, got {'factor': 8.0, 'low_freq_factor': 1.0, 'high_freq_factor': 4.0, 'original_max_position_embeddings': 8192, 'rope_type': 'llama3'}

I had to install transformers==4.43.1 to resolve the issue. Unfortunately, this version of transformers does not have _init_rope in modeling_llama_nxd.py so the existing script may not work out of the box?

v4.4.31.0: https://github.com/huggingface/transformers/blob/e42587f596181396e1c4b63660abf0c736b10dae/src/transformers/models/llama/modeling_llama.py#L258C1-L273C78

v4.43.1: https://github.com/huggingface/transformers/blob/782bfffb2e4dfb5bbe7940429215d794f4434172/src/transformers/models/llama/modeling_llama.py#L306

Steps used to retrieve model weights

Install huggingface_hub:

pip install huggingface_hub

this installs following huggingface_hub:

huggingface_hub version: 0.27.1

then use the followincg command to download model weights:

huggingface-cli download meta-llama/Meta-Llama-3.1-70B --local-dir /fsx/ubuntu/Meta-Llama-3.1-70B
@aws-bowencc
Copy link

Hi @KeitaW, thx for raising this issue due to transformers version update. We are looking into it and will get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants