Skip to content

Failed to convert Llama-v2 models  #4493

Closed
@HighTemplar-wjiang

Description

@HighTemplar-wjiang

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [Y] I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • [Y] I carefully followed the README.md.
  • [Y] I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • [Y] I reviewed the Discussions, and have a new bug or useful enhancement to share.

Expected Behavior

Successful converting Llama models using the following command:

python convert.py models/xxx

where xxx is the original trained Llama model downloaded from Facebook.

Current Behavior

Cannot convert with errors (detailed below).

I've found there was an update in the following commit, after checkout an older version, the conversion could be done:

873637afc7924f435ac44c067630a28e82eefa7b

It seems that after the above commit, convert.py does not support the BPE vocab format anymore (--vocabtype param has been removed). While README did not reflect such change. This causes confusion.

Environment and Context

  • Physical (or virtual) hardware you are using, e.g. for Linux:

Macbook M3 Max

  • Operating System, e.g. for Linux:

MacOS - 14.1 (23B2073)

  • SDK version, e.g. for Linux:

Python 3.10.13
transformers 4.36.1

Failure Information (for bugs)

Loading model file models/13B/consolidated.00.pth
Loading model file models/13B/consolidated.01.pth
params = Params(n_vocab=32000, n_embd=5120, n_layer=40, n_ctx=4096, n_ff=13824, n_head=40, n_head_kv=40, n_experts=None, n_experts_used=None, f_norm_eps=1e-05, rope_scaling_type=None, f_rope_freq_base=None, f_rope_scale=None, n_orig_ctx=None, rope_finetuned=None, ftype=None, path_model=PosixPath('models/13B'))
Traceback (most recent call last):
  File "llama.cpp/convert.py", line 1279, in <module>
    main()
  File "llama.cpp/convert.py", line 1255, in main
    vocab = VocabLoader(params, vocab_dir)
  File "llama.cpp/convert.py", line 342, in __init__
    self.tokenizer = AutoTokenizer.from_pretrained(str(fname_tokenizer), trust_remote_code=True)
  File "python3.10/site-packages/transformers/models/auto/tokenization_auto.py", line 752, in from_pretrained
    config = AutoConfig.from_pretrained(
  File "python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 1082, in from_pretrained
    config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "python3.10/site-packages/transformers/configuration_utils.py", line 644, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "python3.10/site-packages/transformers/configuration_utils.py", line 699, in _get_config_dict
    resolved_config_file = cached_file(
  File "python3.10/site-packages/transformers/utils/hub.py", line 360, in cached_file
    raise EnvironmentError(
OSError: models/13B does not appear to have a file named config.json. Checkout 'https://huggingface.co/models/13B/None' for available files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghigh priorityVery important issuestale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions