如何解决 LLaMA-Factory 微调 InternVL3 报错'Processor was not found'
在使用 LLaMA-Factory 对 InternVL3 模型进行微调时,可能会遇到如下报错:
Processor was not found
该错误通常是由于模型与 LLaMA-Factory 的预处理器(Processor)定义不匹配,导致加载模型时无法找到对应的处理器。以下是完整的排查与解决方案。
1. 环境准备
首先,正确安装 LLaMA-Factory 及其依赖:
git clone --depth 1 https://github.com/hiyouga/LLaMA-Factory.git
cd LLaMA-Factory
pip install -e ".[torch,metrics]" --no-build-isolation
确保 Python 版本 ≥ 3.9,并已安装 PyTorch + CUDA 的 GPU 环境。
2. 问题复现
直接使用 HuggingFace 官方的 InternVL3 模型链接(例如 OpenGVLab/InternVL3-1B)时,在 LLaMA-Factory 中加载会不断报错 Processor was not found。尝试更换 transformers 版本或替换 AutoProcessor 等方法效果不稳定。
3. 解决方案
不使用官方给出的 HF 模型地址,而是使用适配 LLaMA-Factory 的模型版本。即在 HuggingFace 上寻找带有完整 Processor 配置的版本,而非直接拉取官方原始模型。这样 LLaMA-Factory 在加载模型时能自动找到 processor_config.json,避免报错。
4. 示例:微调 InternVL3
当正确使用支持的 HuggingFace 模型后,微调即可顺利进行。以 InternVL3 的自我认知微调为例,模型可以正常加载 Processor 并开始训练。
5. 总结
- 出现 Processor was not found 报错,本质原因是模型与 LLaMA-Factory 的依赖不兼容。
- 解决方法是换用 HuggingFace 上与 LLaMA-Factory 匹配的模型版本,而不是使用官方原始模型。
- 一旦模型能正常加载 Processor,后续的 SFT(微调)、LoRA 等流程就能顺利跑通。


