llamafactory微调模型报错ModuleNotFoundError: No module named ‘triton.ops‘

一、问题

在阿里云Notebook上使用llamafactory微调Meta-Llama-3-8B-Instruct模型报错ModuleNotFoundError: No module named 'triton.ops'

复制代码
Traceback (most recent call last):
  File "/home/user/comfyui/nodes.py", line 2145, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/user/comfyui/custom_nodes/sd-lora-trainer/__init__.py", line 5, in <module>
    from node import Eden_LoRa_trainer
  File "/home/user/comfyui/custom_nodes/sd-lora-trainer/node.py", line 9, in <module>
    from main import train
  File "/home/user/comfyui/custom_nodes/sd-lora-trainer/main.py", line 14, in <module>
    from trainer.utils.utils import *
  File "/home/user/comfyui/custom_nodes/sd-lora-trainer/trainer/utils/utils.py", line 11, in <module>
    from diffusers import AutoencoderKL, DDPMScheduler, EulerDiscreteScheduler, UNet2DConditionModel, StableDiffusionPipeline, StableDiffusionXLPipeline
  File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
  File "/mnt/comfyui/venv/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 911, in __getattr__
    value = getattr(module, name)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/comfyui/venv/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 910, in __getattr__
    module = self._get_module(self._class_to_module[name])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/comfyui/venv/lib/python3.11/site-packages/diffusers/utils/import_utils.py", line 922, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import diffusers.models.autoencoders.autoencoder_kl because of the following error (look up to see its traceback):
No module named 'triton.ops'

Cannot import /home/user/comfyui/custom_nodes/sd-lora-trainer module for custom nodes: Failed to import diffusers.models.autoencoders.autoencoder_kl because of the following error (look up to see its traceback):
No module named 'triton.ops'
...
二、原因

在triton新版本中,triton.ops不存在了,可在triton的github上找到对应问题:
In version 3.2.0 of triton, triton.ops no longer exists (triton-lang/triton#5471)

from: https://github.com/edenartlab/sd-lora-trainer/issues/12

二、问题解决

参考github上Import error with latest version of triton #12

给出的解决方案,调整triton为旧版本

查看triton的版本(https://github.com/triton-lang/triton/blob/main/RELEASE.md)如下:

这里选择旧一点的版本: 2.3.0

复制代码
pip uninstall triton
pip install triton==2.3.0

重新启动llamafactory-cli webui,进行微调,可正常运行:


参考:

1.https://github.com/edenartlab/sd-lora-trainer/issues/12

2.https://github.com/triton-lang/triton/blob/main/RELEASE.md

相关推荐
咕噜咕噜day2 天前
高效微调方法简述
微调·adapter·lora微调·微调与rag区别·微调分类
风筝超冷2 天前
LLaMaFactory - 支持的模型和模板 && 常用命令
llamafactory
Toky丶5 天前
SmolVLM2: The Smollest Video Model Ever(七)
人工智能·大模型·微调
阿丢是丢心心6 天前
【从0到1搞懂大模型】chatGPT 中的对齐优化(RLHF)讲解与实战(9)
chatgpt·微调·强化学习·rlhf
小草cys20 天前
使用LoRA微调Qwen2.5-VL-7B-Instruct完成电气主接线图识别
lora·微调·qwen
为啥全要学20 天前
LLaMA-Factory 微调 Qwen2-7B-Instruct
llama·大模型微调·llamafactory
玩电脑的辣条哥21 天前
什么是alpaca 或 sharegpt 格式的数据集?
lora·微调·数据集
Code_流苏21 天前
《Python星球日记》 第72天:问答系统与信息检索
python·微调·问答系统·bert·应用场景·基于检索·基于生成
太空眼睛22 天前
【LLaMA-Factory】使用LoRa微调训练DeepSeek-R1-Distill-Qwen-7B
lora·微调·sft·训练·deepspeed·llama-factory·deepseek
AI大模型顾潇23 天前
[特殊字符] 本地部署DeepSeek大模型:安全加固与企业级集成方案
数据库·人工智能·安全·大模型·llm·微调·llama