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

fix(convert-hf-to-gguf): requires einops for InternLM2ForCausalLM models #5792

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

Nold360
Copy link
Contributor

@Nold360 Nold360 commented Feb 29, 2024

small fix for container images, which will currently fail with:

Traceback (most recent call last):
  File "/app/convert-hf-to-gguf.py", line 1934, in <module>
gguf: This GGUF file is for Little Endian only
Set model parameters
Set model tokenizer
InternLM2 convert token 'b'\x00'' to '🐉'!
gguf: Setting special token type bos to 1
gguf: Setting special token type eos to 2
gguf: Setting special token type pad to 2
gguf: Setting chat_template to {{ bos_token }}{% for message in messages %}{{'<|im_start|>' + message['role'] + '
' + message['content'] + '<|im_end|>' + '
'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
' }}{% endif %}
Exporting model to '/workspace/input/ggml-model-f16.gguf'
    main()
  File "/app/convert-hf-to-gguf.py", line 1928, in main
    model_instance.write()
  File "/app/convert-hf-to-gguf.py", line 152, in write
    self.write_tensors()
  File "/app/convert-hf-to-gguf.py", line 1612, in write_tensors
    from einops import rearrange
ModuleNotFoundError: No module named 'einops'
Traceback (most recent call last):
  File "/app/convert.py", line 1483, in <module>

used 0.7.0 cause it's the current release.

@cebtenzzre cebtenzzre requested a review from crasm February 29, 2024 16:38
@cebtenzzre
Copy link
Collaborator

@crasm Were these files meant to contain required dependencies, or also include optional dependencies? In the latter case, this PR is a step in the right direction, but we also need to add tiktoken for Qwen models.

@Nold360
Copy link
Contributor Author

Nold360 commented Feb 29, 2024

@crasm Were these files meant to contain required dependencies, or also include optional dependencies? In the latter case, this PR is a step in the right direction, but we also need to add tiktoken for Qwen models.

good point. imho they are so tiny compared to the rest, that we could just add them before building workarounds for containers

@crasm
Copy link
Contributor

crasm commented Feb 29, 2024

@crasm Were these files meant to contain required dependencies, or also include optional dependencies? In the latter case, this PR is a step in the right direction, but we also need to add tiktoken for Qwen models.

It's supposed to be for all dependencies.

The check-requirements.sh script and workflow were intended to prevent these kinds of PRs from being necessary, by forcing all dependencies to be declared in the requirements.txt files.

Has the workflow check been failing consistently from running out of space, like in the other PR you tagged me? (edit: yes) That could explain why these are slipping though.

@crasm
Copy link
Contributor

crasm commented Feb 29, 2024

Maybe it'd be better to forgo the complexity I introduced in the requirements.txt. We could just do #5745 and declare each script's optional dependencies in the pyproject.toml.

Copy link
Collaborator

@cebtenzzre cebtenzzre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is an improvement, and is fine by me until we have a better solution.

Copy link
Contributor

@crasm crasm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'll investigate the disk space issue, which I suspect is a configuration issue rather than an actual resource limitation.

@cebtenzzre cebtenzzre merged commit da3b9ba into ggerganov:master Mar 1, 2024
22 of 23 checks passed
@crasm
Copy link
Contributor

crasm commented Mar 1, 2024

I'm trying to figure out how to catch any more of these implicit dependencies to prevent more gotchas.

@cebtenzzre Is it normal to have import statements embedded in various places in python scripts? That seems crazy to me coming from other languages.

@cebtenzzre
Copy link
Collaborator

cebtenzzre commented Mar 1, 2024

Is it normal to have import statements embedded in various places in python scripts? That seems crazy to me coming from other languages.

Yep, this is how optional dependencies are typically implemented in python - you import them lazily so they only matter if the code that needs them is run. With a venv and a type checker like mypy, it's not hard to detect if these dependencies are missing when they shouldn't be - it will complain with import-not-found.

hazelnutcloud pushed a commit to hazelnutcloud/llama.cpp that referenced this pull request Mar 10, 2024
jordankanter pushed a commit to jordankanter/llama.cpp that referenced this pull request Mar 13, 2024
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 1, 2024
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

Successfully merging this pull request may close these issues.

3 participants