Skip to content

[Question]: Error when running the tutorial #214

@zhimin-z

Description

@zhimin-z

Hi, everyone, I am trying to run the folllowing code at https://github.com/microsoft/LLMLingua/blob/main/examples/LLMLingua2.ipynb:

from llmlingua import PromptCompressor
llm_lingua = PromptCompressor(
    model_name="microsoft/llmlingua-2-xlm-roberta-large-meetingbank",
    use_llmlingua2=True,
)

However, it throws the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File c:\Users\zhimi\OneDrive\Documents\GitHub\Software-Engineer-Arena\.venv\Lib\site-packages\transformers\utils\import_utils.py:1976, in _LazyModule._get_module(self, module_name)
   [1975](file:///C:/Users/zhimi/OneDrive/Documents/GitHub/Software-Engineer-Arena/.venv/Lib/site-packages/transformers/utils/import_utils.py:1975) try:
-> [1976](file:///C:/Users/zhimi/OneDrive/Documents/GitHub/Software-Engineer-Arena/.venv/Lib/site-packages/transformers/utils/import_utils.py:1976)     return importlib.import_module("." + module_name, self.__name__)
   [1977](file:///C:/Users/zhimi/OneDrive/Documents/GitHub/Software-Engineer-Arena/.venv/Lib/site-packages/transformers/utils/import_utils.py:1977) except Exception as e:

File ~\AppData\Local\Programs\Python\Python313\Lib\importlib\__init__.py:88, in import_module(name, package)
     [87](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/zhimi/OneDrive/Documents/GitHub/Software-Engineer-Arena/~/AppData/Local/Programs/Python/Python313/Lib/importlib/__init__.py:87)         level += 1
---> [88](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/zhimi/OneDrive/Documents/GitHub/Software-Engineer-Arena/~/AppData/Local/Programs/Python/Python313/Lib/importlib/__init__.py:88) return _bootstrap._gcd_import(name[level:], package, level)

File <frozen importlib._bootstrap>:1387, in _gcd_import(name, package, level)

File <frozen importlib._bootstrap>:1360, in _find_and_load(name, import_)

File <frozen importlib._bootstrap>:1331, in _find_and_load_unlocked(name, import_)

File <frozen importlib._bootstrap>:935, in _load_unlocked(spec)

File <frozen importlib._bootstrap_external>:1022, in exec_module(self, module)

File <frozen importlib._bootstrap>:488, in _call_with_frames_removed(f, *args, **kwds)

File c:\Users\zhimi\OneDrive\Documents\GitHub\Software-Engineer-Arena\.venv\Lib\site-packages\transformers\models\xlm_roberta\modeling_xlm_roberta.py:43
     [33](file:///C:/Users/zhimi/OneDrive/Documents/GitHub/Software-Engineer-Arena/.venv/Lib/site-packages/transformers/models/xlm_roberta/modeling_xlm_roberta.py:33) from ...modeling_outputs import (
...
   [1980](file:///C:/Users/zhimi/OneDrive/Documents/GitHub/Software-Engineer-Arena/.venv/Lib/site-packages/transformers/utils/import_utils.py:1980)         f" traceback):\n{e}"
   [1981](file:///C:/Users/zhimi/OneDrive/Documents/GitHub/Software-Engineer-Arena/.venv/Lib/site-packages/transformers/utils/import_utils.py:1981)     ) from e

RuntimeError: Failed to import transformers.models.xlm_roberta.modeling_xlm_roberta because of the following error (look up to see its traceback):
partially initialized module 'torch._dynamo' from 'c:\Users\zhimi\OneDrive\Documents\GitHub\Software-Engineer-Arena\.venv\Lib\site-packages\torch\_dynamo\__init__.py' has no attribute 'external_utils' (most likely due to a circular import)

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions