luca-medeiros / lang-segment-anything

SAM with text prompt
Apache License 2.0
1.53k stars 167 forks source link

I am unable to import the module now. #67

Closed MistyDragon7 closed 1 month ago

MistyDragon7 commented 1 month ago

Instructions To Reproduce the 🐛 Bug:

Forked the repo to my own account. Installed the module without errors. Then I ran the following:

from lang_sam import LangSAM Immediately gave me an error. The error received seems to have no cause at all:

Error

ImportError Traceback (most recent call last)

/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name) 1352 try: -> 1353 return importlib.import_module("." + module_name, self.name) 1354 except Exception as e:

32 frames

ImportError: cannot import name 'split_torch_state_dict_into_shards' from 'huggingface_hub' (/usr/local/lib/python3.10/dist-packages/huggingface_hub/init.py)

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last)

RuntimeError: 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' (/usr/local/lib/python3.10/dist-packages/huggingface_hub/init.py)

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last)

/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name) 1353 return importlib.import_module("." + module_name, self.name) 1354 except Exception as e: -> 1355 raise RuntimeError( 1356 f"Failed to import {self.name}.{module_name} because of the following error (look up to see its" 1357 f" traceback):\n{e}"

RuntimeError: Failed to import transformers.models.bert.modeling_bert 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' (/usr/local/lib/python3.10/dist-packages/huggingface_hub/init.py)

Please help me resolve this to the earliest.

YuxinYao620 commented 1 month ago

Hi, I have the same problem, may I ask did you solve it? Thank you!

MistyDragon7 commented 1 month ago

Yes I did, I also made a pull request to fix the issue; it's upto the repository owner to accept the PR now.

just1nseo commented 1 month ago

@MistyDragon7 I am also having a same issue. Why did you close the issue ? Did you solve it? If you did, how ?

MistyDragon7 commented 1 month ago

I have fixed it, and my changes have been merged to the main repo, that is why. There were version conflicts which I fixed in the #68 Pull Request.