OpenMOSS / OpenMOSS/AnyGPT

cannot import name 'split_torch_state_dict_into_shards' from 'huggingface_hub'

Open
#35 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
882
Forks
76
PR merge metrics
No merged PRs in 30d

Description

I just input:

python anygpt/src/infer/cli_infer_chat_model.py \
--model-name-or-path models/AnyGPT-chat \
--image-tokenizer-path models/seed-tokenizer-2/seed_quantizer.pt \
--speech-tokenizer-path models/speechtokenizer/ckpt.dev \
--speech-tokenizer-config models/speechtokenizer/config.json \
--soundstorm-path models/soundstorm/speechtokenizer_soundstorm_mls.pt \
--output-dir "infer_output/chat"

then output:

RuntimeError: Failed to import transformers.models.llama.modeling_llama because of the following error (look up to see its traceback):
Failed to import transformers.generation.utils because of the following error (look up to see its traceback):
cannot import name 'split_torch_state_dict_into_shards' from 'huggingface_hub' (/home/guest/anaconda3/envs/AnyGPT/lib/python3.9/site-packages/huggingface_hub/__init__.py)

I find the huggingface_hub version is 0.17.3, that is why throw error. But when I update it, pip show:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tokenizers 0.14.1 requires huggingface_hub<0.18,>=0.16.4, but you have huggingface-hub 0.24.0 which is incompatible.

I can't downgrade huggingface_hub because it needs split_torch_state_dict_into_shards. So how to solve it, should I ignore pip's error?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running anygpt/src/infer/cli_infer_chat_model.py with the command shown and inspect the installed huggingface_hub and tokenizers versions. Trace the transformers import failure and the dependency constraints around split_torch_state_dict_into_shards. Done means the CLI starts without the import error and the selected package versions no longer produce a dependency conflict.

Written by the indexing model from the issue text.

Assessment

Tech stack
huggingface, python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.