ymcui / Chinese-LLaMA-Alpaca-2

中文LLaMA-2 & Alpaca-2大模型二期项目 + 64K超长上下文模型 (Chinese LLaMA-2 & Alpaca-2 LLMs with 64K long context models)
Apache License 2.0
7.04k stars 581 forks source link

使用完整模型进行摘要生成,出现问题 #387

Closed 1042312930 closed 10 months ago

1042312930 commented 10 months ago

提交前必须检查以下项目

问题类型

其他问题

基础模型

Chinese-Alpaca-2 (7B/13B)

操作系统

Windows

详细描述问题

上次说是模型不一样,换了一个模型使用的是 image


下载后直接使用
# 使用教程
https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki/langchain_zh 
# 中的摘要出现了问题
python langchain_sum.py --model_path .\chinese-alpaca-2-7b-hf\ --file_path doc.txt --gpu_id 0

依赖情况(代码类问题务必提供)

peft                              0.6.0.dev0
torch                            2.1.0+cu121
transformers                4.31.0
sentencepiece              0.1.97
bitsandbytes                0.41.0

langchain                     0.0.146
sentence-transformers   2.2.2
pydantic                         1.10.8
faiss                              1.7.1

运行日志或截图

# 请在此处粘贴运行日志(请粘贴在本代码块里)
Namespace(file_path='mydoc.txt', model_path='chinese-alpaca-2-7b-hf', gpu_id='0', chain_type='refine')
loading LLM...
You are using the legacy behaviour of the <class 'transformers.models.llama.tokenization_llama.LlamaTokenizer'>. This means that tokens that come after special tokens will not be properly handled. We recommend you to read the related pull request available at https://github.com/huggingface/transformers/pull/24565
Loading checkpoint shards: 100%|██████████| 2/2 [01:19<00:00, 39.64s/it]
Xformers is not installed correctly. If you want to use memory_efficient_attention to accelerate training use the following command to install Xformers
pip install xformers.
Traceback (most recent call last):
  File "C:\Users\zx-cent\PycharmProjects\pythonaimodel\my_test.py", line 54, in <module>
    model = HuggingFacePipeline.from_model_id(model_id=model_path,
  File "C:\Users\zx-cent\.conda\envs\pythonaivenv\lib\site-packages\langchain\llms\huggingface_pipeline.py", line 130, in from_model_id
    return cls(
  File "pydantic\main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for HuggingFacePipeline
pipeline_kwargs
  extra fields not permitted (type=value_error.extra)
ymcui commented 10 months ago

上一次讲过了,多半是安装的这些库版本不兼容导致的,这个就自行debug解决吧。 各个依赖库更新都比较快,很可能是接口发生了变化导致的这个错误。 报错提示似乎是HuggingFacePipeline这里不接受指定pipeline_kwargs

1042312930 commented 10 months ago

问题已解决,之前langchain版本过低(0.0.146),更新为0.0.329问题解决