Llama-Chinese icon indicating copy to clipboard operation
Llama-Chinese copied to clipboard

执行python quick_start.py始终报错

Open moffefei opened this issue 10 months ago • 4 comments

PS D:\tools\100AIGC\Llama-Chinese> python quick_start.py Traceback (most recent call last): File "D:\tools\100AIGC\Llama-Chinese\quick_start.py", line 4, in <module> model = AutoModelForCausalLM.from_pretrained('Llama3-Chinese-8B-Instruct',device_map=device_map,torch_dtype=torch.float16,load_in_8bit=True,trust_remote_code=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\1\AppData\Local\Programs\Python\Python312\Lib\site-packages\transformers\models\auto\auto_factory.py", line 550, in from_pretrained model_class = get_class_from_dynamic_module( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\1\AppData\Local\Programs\Python\Python312\Lib\site-packages\transformers\dynamic_module_utils.py", line 489, in get_class_from_dynamic_module final_module = get_cached_module_file( ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\1\AppData\Local\Programs\Python\Python312\Lib\site-packages\transformers\dynamic_module_utils.py", line 315, in get_cached_module_file modules_needed = check_imports(resolved_module_file) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\1\AppData\Local\Programs\Python\Python312\Lib\site-packages\transformers\dynamic_module_utils.py", line 180, in check_imports raise ImportError( ImportError: This modeling file requires the following packages that were not found in your environment: flash_attn. Run pip install flash_attn``

按照这个提醒,安装flash_attn S D:\tools\100AIGC\Llama-Chinese> pip install flash-attn Collecting flash-attn Using cached flash_attn-2.5.7.tar.gz (2.5 MB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [20 lines of output] Traceback (most recent call last): File "C:\Users\1\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "C:\Users\1\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\1\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\1\AppData\Local\Temp\pip-build-env-isl1utrg\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\1\AppData\Local\Temp\pip-build-env-isl1utrg\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires self.run_setup() File "C:\Users\1\AppData\Local\Temp\pip-build-env-isl1utrg\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup super().run_setup(setup_script=setup_script) File "C:\Users\1\AppData\Local\Temp\pip-build-env-isl1utrg\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup exec(code, locals()) File "", line 9, in ModuleNotFoundError: No module named 'packaging' [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

GPT查了下,说是python版本问题,我的是python312

moffefei avatar Apr 23 '24 13:04 moffefei

在Mac M1平台上,可以重现这个问题。即使注释掉 use_flash_attention_2=True,也还会问缺少 flash_attn 组件。

gbpgap11 avatar Apr 24 '24 15:04 gbpgap11

mac m1怎么搞呢

starryCSDN avatar May 03 '24 16:05 starryCSDN

同问 macm1 怎么搞

wangzilong1997 avatar May 09 '24 03:05 wangzilong1997

这边下载了flash_attn之后由于使用的是V100,不支持flash_attn,之后把True改成False可以通过,只不过非常之慢

notalking569 avatar Jul 01 '24 14:07 notalking569