THUDM / ChatGLM3

ChatGLM3 series: Open Bilingual Chat LLMs | 开源双语对话语言模型
Apache License 2.0
13.12k stars 1.51k forks source link

lora微调成功复现但是infere推理报错nan #923

Closed fuzhao123232 closed 4 months ago

fuzhao123232 commented 4 months ago

System Info / 系統信息

absl-py 1.4.0 accelerate 0.27.2 addict 2.4.0 aiofiles 23.2.1 aiohttp 3.9.3 aiosignal 1.3.1 altair 5.2.0 annotated-types 0.6.0 anyio 4.3.0 arxiv 2.1.0 asttokens 2.2.1 async-timeout 4.0.3 attrs 23.2.0 backcall 0.2.0 blinker 1.7.0 cachetools 5.3.1 certifi 2024.2.2 charset-normalizer 3.3.2 click 8.1.7 cmake 3.26.0 colorama 0.4.6 comm 0.1.3 ConfigArgParse 1.5.3 contourpy 1.1.0 cpm-kernels 1.0.11 cycler 0.11.0 dash 2.9.3 dash-core-components 2.0.0 dash-html-components 2.0.0 dash-table 5.0.0 dataclasses-json 0.6.4 datasets 2.18.0 debugpy 1.6.7 dill 0.3.8 distro 1.9.0 exceptiongroup 1.2.0 executing 1.2.0 fastapi 0.110.0 fastjsonschema 2.16.3 feedparser 6.0.10 ffmpy 0.3.2 filelock 3.10.0 Flask 2.2.3 fonttools 4.41.1 frozenlist 1.4.1 fsspec 2024.2.0 gitdb 4.0.11 GitPython 3.1.42 google-auth 2.22.0 google-auth-oauthlib 1.0.0 gradio 4.19.2 gradio_client 0.10.1 greenlet 3.0.3 grpcio 1.57.0 h11 0.14.0 httpcore 1.0.4 httpx 0.27.0 huggingface-hub 0.21.3 idna 3.6 imageio-ffmpeg 0.4.8 importlib-metadata 7.0.1 importlib_resources 6.1.2 ipykernel 6.22.0 ipython 8.12.0 ipywidgets 8.0.6 itsdangerous 2.1.2 jedi 0.18.2 jieba 0.42.1 Jinja2 3.1.2 joblib 1.2.0 jsonpatch 1.33 jsonpointer 2.4 jsonschema 4.17.3 jupyter_client 8.6.0 jupyter_core 5.3.0 jupyterlab-widgets 3.0.7 kiwisolver 1.4.4 langchain 0.1.10 langchain-community 0.0.25 langchain-core 0.1.29 langchain-text-splitters 0.0.1 langchainhub 0.1.15 langsmith 0.1.18 latex2mathml 3.77.0 lazy_loader 0.2 lit 15.0.7 loguru 0.7.2 Markdown 3.4.3 markdown-it-py 2.2.0 MarkupSafe 2.1.2 marshmallow 3.21.1 matplotlib 3.8.3 matplotlib-inline 0.1.6 mdtex2html 1.3.0 mdurl 0.1.2 model-index 0.1.11 mpmath 1.3.0 multidict 6.0.5 multiprocess 0.70.16 mypy-extensions 1.0.0 nbformat 5.7.0 nest-asyncio 1.5.6 networkx 3.0 nltk 3.8.1 numpy 1.26.4 nvidia-cublas-cu11 11.10.3.66 nvidia-cublas-cu12 12.1.3.1 nvidia-cuda-cupti-cu11 11.7.101 nvidia-cuda-cupti-cu12 12.1.105 nvidia-cuda-nvrtc-cu11 11.7.99 nvidia-cuda-nvrtc-cu12 12.1.105 nvidia-cuda-runtime-cu11 11.7.99 nvidia-cuda-runtime-cu12 12.1.105 nvidia-cudnn-cu11 8.5.0.96 nvidia-cudnn-cu12 8.9.2.26 nvidia-cufft-cu11 10.9.0.58 nvidia-cufft-cu12 11.0.2.54 nvidia-curand-cu11 10.2.10.91 nvidia-curand-cu12 10.3.2.106 nvidia-cusolver-cu11 11.4.0.1 nvidia-cusolver-cu12 11.4.5.107 nvidia-cusparse-cu11 11.7.4.91 nvidia-cusparse-cu12 12.1.0.106 nvidia-nccl-cu11 2.14.3 nvidia-nccl-cu12 2.19.3 nvidia-nvjitlink-cu12 12.3.101 nvidia-nvtx-cu11 11.7.91 nvidia-nvtx-cu12 12.1.105 open3d 0.17.0 openai 1.13.3 opencv-python 4.9.0.80 openmim 0.3.7 ordered-set 4.1.0 orjson 3.9.15 packaging 23.2 pandas 2.0.0 parso 0.8.3 peft 0.7.1 pickleshare 0.7.5 pillow 10.2.0 pip 23.3.1 platformdirs 3.2.0 plotly 5.14.1 prompt-toolkit 3.0.38 protobuf 4.25.3 psutil 5.9.5 pure-eval 0.2.2 py-cpuinfo 9.0.0 pyarrow 15.0.0 pyarrow-hotfix 0.6 pybind11 2.11.1 pycparser 2.21 pydantic 2.6.3 pydantic_core 2.16.3 pydeck 0.8.1b0 pydub 0.25.1 Pygments 2.14.0 PyJWT 2.8.0 pykdtree 1.3.7.post0 pyparsing 3.1.1 pyquaternion 0.9.9 pyrsistent 0.19.3 python-dateutil 2.8.2 python-multipart 0.0.9 pytz 2024.1 PyWavelets 1.4.1 PyYAML 6.0.1 pyzmq 25.0.2 regex 2023.12.25 requests 2.31.0 requests-oauthlib 1.3.1 rich 13.7.1 rouge-chinese 1.0.3 rsa 4.9 ruamel.yaml 0.18.6 ruamel.yaml.clib 0.2.8 ruff 0.3.0 safetensors 0.4.2 scikit-build 0.17.2 scikit-learn 1.4.1.post1 scipy 1.12.0 seaborn 0.13.2 semantic-version 2.10.0 sentence-transformers 2.5.1 sentencepiece 0.2.0 setuptools 68.2.2 sgmllib3k 1.0.0 shellingham 1.5.4 six 1.16.0 smmap 5.0.1 sniffio 1.3.1 SQLAlchemy 2.0.28 sse-starlette 2.0.0 stack-data 0.6.2 starlette 0.36.3 streamlit 1.31.1 sympy 1.12 tabulate 0.9.0 tenacity 8.2.2 tensorboard 2.14.0 tensorboard-data-server 0.7.1 thop 0.1.1.post2209072238 threadpoolctl 3.1.0 tifffile 2023.4.12 tiktoken 0.6.0 timm 0.9.16 tokenizers 0.15.2 toml 0.10.2 tomli 2.0.1 tomlkit 0.12.0 toolz 0.12.1 torch 2.2.1 torchaudio 0.13.1+cu116 torchvision 0.17.1 tornado 6.3.1 tqdm 4.65.0 traitlets 5.9.0 transformers 4.38.2 triton 2.2.0 typer 0.9.0 types-requests 2.31.0.20240218 typing_extensions 4.10.0 typing-inspect 0.9.0 tzdata 2023.3 tzlocal 5.2 ultralytics 8.1.18 urllib3 2.2.1 uvicorn 0.27.1 validators 0.22.0 watchdog 4.0.0 wcwidth 0.2.6 websockets 11.0.3 Werkzeug 2.2.3 wheel 0.41.2 widgetsnbextension 4.0.7 xxhash 3.4.1 yarl 1.9.4 zhipuai 2.0.1 zipp 3.17.0

Who can help? / 谁可以帮助到您?

@Btlmd

Information / 问题信息

Reproduction / 复现过程

全都是finetune_demo下面的代码,微调复现成功,结果如下:对比官方demo: image image

但是推理报错: image 尝试参考网上说法:https://blog.csdn.net/weixin_44563460/article/details/133800257 image

结果是乱的: image

Expected behavior / 期待表现

希望可以修复bug,谢谢

zRzRzRzRzRzRzR commented 4 months ago

超出词表了,正常来说新的chatglm3-6b huggingface 配置文件已经修了这个问题啊,我看你这个好多混合语言的,估计是出现这个问题?

fuzhao123232 commented 4 months ago

非常感谢作者的回答,我最近刚入手NLP,之前都是做CV的,不太理解超出词表了该怎么解决,有reference吗?另外,我是上周五clone的代码,和现在的你们仓库的官方代码一模一样啊 image

fuzhao123232 commented 4 months ago

并且我的prompt和你们lora的jupternotebook也是一样的 ![Uploading image.png…]()

zRzRzRzRzRzRzR commented 4 months ago

似乎没遇到相似的问题,应该和微调没有关系,每次提问都能发生吗。 如果是偶发性的,大概就是生成的时候出现了词表外的词,这个问题我们huggingface上的代码已经修复过了,尝试更新一下?