yanqiangmiffy / Chinese-LangChain

中文langchain项目|小必应,Q.Talk,强聊,QiangTalk
2.67k stars 323 forks source link

安装了必要的库,但是运行报错,是transformers版本问题嘛? #56

Open yuxiaobopp opened 5 months ago

yuxiaobopp commented 5 months ago

我的异常: Cannot load cpu kernel, don't use quantized model on cpu. Applying quantization to glm layers 2024-03-20 12:53:44,250 [INFO] [modeling_chatglm.py:1415] Applying quantization to embeddings Traceback (most recent call last): File "e:\miniconda3\lib\site-packages\langchain_community\embeddings\huggingface.py", line 59, in init import sentence_transformers File "e:\miniconda3\lib\site-packages\sentence_transformers__init__.py", line 3, in from .datasets import SentencesDataset, ParallelSentencesDataset File "e:\miniconda3\lib\site-packages\sentence_transformers\datasets__init__.py", line 1, in from .DenoisingAutoEncoderDataset import DenoisingAutoEncoderDataset File "e:\miniconda3\lib\site-packages\sentence_transformers\datasets\DenoisingAutoEncoderDataset.py", line 5, in from transformers.utils.import_utils import is_nltk_available, NLTK_IMPORT_ERROR ImportError: cannot import name 'is_nltk_available' from 'transformers.utils.import_utils' (e:\miniconda3\lib\site-packages\transformers\utils\import_utils.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "E:\LangChain\Chinese-LangChain-master\main.py", line 27, in application = LangChainApplication(config) File "E:\LangChain\Chinese-LangChain-master\clc\langchain_application.py", line 26, in init self.source_service = SourceService(config) File "E:\LangChain\Chinese-LangChain-master\clc\source_service.py", line 25, in init self.embeddings = HuggingFaceEmbeddings(model_name=self.config.embedding_model_name) File "e:\miniconda3\lib\site-packages\langchain_community\embeddings\huggingface.py", line 62, in init raise ImportError( ImportError: Could not import sentence_transformers python package. Please install it with pip install sentence-transformers.


我的requirements.txt: absl-py==1.4.0 accelerate==0.28.0 addict==2.4.0 aiofiles==23.2.1 aiohttp==3.9.3 aiohttp-retry==2.8.3 aiosignal==1.3.1 alembic==1.13.1 aliyun-python-sdk-core==2.15.0 aliyun-python-sdk-kms==2.16.2 altair==5.2.0 amqp==5.2.0 aniso8601==9.0.1 annotated-types==0.6.0 ansicon==1.89.0 anthropic==0.17.0 antlr4-python3-runtime==4.9.3 anyio==4.2.0 appbuilder-sdk==0.4.1 appdirs==1.4.4 Appium-Python-Client==2.9.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.3.0 arxiv==2.1.0 astor==0.8.1 astroid==2.15.0 asttokens==2.4.1 async-generator==1.10 async-lru==2.0.4 async-timeout==4.0.3 asyncio-atexit==1.0.1 attrdict==2.0.1 attrs==22.2.0 Authlib==1.2.0 autopep8==2.0.2 azure-cognitiveservices-speech==1.36.0 azure-core==1.30.1 azure-storage-blob==12.19.1 Babel==2.14.0 backoff==2.2.1 bce-python-sdk==0.9.4 beautifulsoup4==4.12.2 billiard==3.6.4.0 bleach==6.1.0 blessed==1.20.0 blinker==1.7.0 blis==0.7.11 boto3==1.28.17 botocore==1.31.85 bowler==0.9.0 Brotli==1.1.0 brotlipy==0.7.0 bs4==0.0.2 cachetools==4.2.4 catalogue==2.0.10 cchardet==2.1.7 celery==5.2.7 certifi @ file:///C:/b/abs_85o_6fm0se/croot/certifi_1671487778835/work/certifi cffi @ file:///C:/b/abs_49n3v2hyhr/croot/cffi_1670423218144/work chardet==5.1.0 charset-normalizer @ file:///tmp/build/80754af9/charset-normalizer_1630003229654/work click==8.1.7 click-didyoumean==0.3.0 click-plugins==1.1.1 click-repl==0.3.0 cloudpathlib==0.16.0 cloudpickle==3.0.0 cohere==4.56 colorama @ file:///C:/b/abs_a9ozq0l032/croot/colorama_1672387194846/work colorlog==6.8.2 comm==0.2.1 conda==23.1.0 conda-content-trust @ file:///C:/Windows/TEMP/abs_4589313d-fc62-4ccc-81c0-b801b4449e833j1ajrwu/croots/recipe/conda-content-trust_1658126379362/work conda-package-handling @ file:///C:/b/abs_fcga8w0uem/croot/conda-package-handling_1672865024290/work conda_package_streaming @ file:///C:/b/abs_0e5n5hdal3/croot/conda-package-streaming_1670508162902/work confection==0.1.4 contourpy==1.2.0 coverage==7.2.7 cpm-kernels==1.0.11 crcmod==1.7 cryptography @ file:///C:/b/abs_b7d7drzbky/croot/cryptography_1673298763653/work cssselect==1.2.0 cssutils==2.9.0 curl_cffi==0.6.3b1 cycler==0.12.1 cymem==2.0.8 Cython==3.0.9 dashscope==1.14.1 dask==2022.1.1 dataclasses==0.6 dataclasses-json==0.5.14 datasets==2.18.0 debugpy==1.8.0 decorator==5.1.1 defusedxml==0.7.1 dill==0.3.8 diskcache==5.6.3 distro==1.9.0 docstring-to-markdown==0.12 duckduckgo-search==2.9.0 editor==1.6.6 einops==0.7.0 emoji==2.10.1 environs==9.5.0 erniebot==0.5.3 erniebot_agent==0.5.1 et-xmlfile==1.1.0 exceptiongroup==1.1.1 executing==2.0.1 faiss-cpu==1.8.0 fastapi==0.110.0 fastavro==1.9.4 fastjsonschema==2.19.1 feedfinder2==0.0.4 feedparser==6.0.10 ffmpy==0.3.2 filelock==3.13.1 filetype==1.2.0 fire==0.6.0 fissix==21.11.13 flake8==6.0.0 Flask==3.0.2 flask-babel==4.0.0 Flask-Compress==1.14 Flask-Cors==4.0.0 Flask-Login==0.6.3 Flask-Migrate==4.0.7 Flask-RESTful==0.3.10 Flask-SQLAlchemy==3.0.5 fonttools==4.47.2 fqdn==1.5.1 frozendict==2.4.0 frozenlist==1.4.1 fsspec==2023.12.2 future==1.0.0 gast==0.5.4 gevent==23.9.1 git-python==1.0.3 gitdb==4.0.11 GitPython==3.1.41 gmpy2==2.1.5 google-ai-generativelanguage==0.4.0 google-api-core==1.34.0 google-api-python-client==2.90.0 google-auth==2.15.0 google-auth-httplib2==0.2.0 google-crc32c==1.5.0 google-generativeai==0.4.1 google-resumable-media==1.3.3 google_search_results==2.4.2 googleapis-common-protos==1.63.0 gradio==4.19.2 gradio_client==0.10.1 greenlet==3.0.3 gunicorn==21.2.0 h11==0.14.0 h2==4.1.0 hf_transfer==0.1.6 hpack==4.0.0 html2image==2.0.4.3 html5lib==1.1 httpcore==1.0.4 httplib2==0.22.0 httptools==0.6.1 httpx==0.25.2 huggingface-hub==0.21.4 hyperframe==6.0.1 idna @ file:///C:/b/abs_bdhbebrioa/croot/idna_1666125572046/work imageio==2.34.0 imgaug==0.4.0 importlib-metadata==6.11.0 importlib_resources==6.1.2 iniconfig==2.0.0 inquirer==3.2.3 ipykernel==6.29.0 ipython==8.21.0 ipywidgets==8.1.2 isodate==0.6.1 isoduration==20.11.0 isort==5.12.0 itsdangerous==2.1.2 jedi==0.18.2 jieba==0.42.1 jieba3k==0.35.1 Jinja2==3.1.2 jinxed==1.2.1 jmespath==0.10.0 joblib==1.3.2 JPype1==1.5.0 json5==0.9.22 jsonpatch==1.33 jsonpointer==2.4 jsonschema==4.21.1 jsonschema-path==0.3.2 jsonschema-specifications==2023.12.1 jupyter==1.0.0 jupyter-console==6.6.3 jupyter-events==0.9.0 jupyter-lsp==2.2.4 jupyter_client==8.6.0 jupyter_core==5.7.1 jupyter_server==2.13.0 jupyter_server_terminals==0.5.2 jupyterlab==4.1.4 jupyterlab_pygments==0.3.0 jupyterlab_server==2.25.3 jupyterlab_widgets==3.0.10 kiwisolver==1.4.5 kombu==5.3.5 langchain==0.1.12 langchain-community==0.0.28 langchain-core==0.1.32 langchain-text-splitters==0.0.1 langcodes==3.3.0 langdetect==1.0.9 langsmith==0.1.27 latex2mathml==3.77.0 lazy-object-proxy==1.9.0 lazy_loader==0.3 litellm==1.21.7 llama_cpp_python==0.2.56 llvmlite==0.42.0 lmdb==1.4.1 locket==1.0.0 loguru==0.7.2 lxml==5.1.0 mailchimp-transactional==1.0.56 Mako==1.3.2 Markdown==3.5.2 markdown-it-py==3.0.0 MarkupSafe==2.1.2 marshmallow==3.21.0 matplotlib==3.8.2 matplotlib-inline==0.1.6 mccabe==0.7.0 mdtex2html==1.3.0 mdurl==0.1.2 menuinst @ file:///C:/Users/BUILDE~1/AppData/Local/Temp/abs_455sf5o0ct/croots/recipe/menuinst_1661805970842/work minio==7.2.5 mistune==3.0.2 mmh3==4.1.0 modelscope==1.12.0 monotonic==1.6 moreorless==0.4.0 mpmath==1.3.0 msg-parser==1.2.0 multidict==6.0.5 multiprocess==0.70.16 multitasking==0.0.11 murmurhash==1.0.10 mypy==1.9.0 mypy-extensions==1.0.0 mypy-protobuf==3.1.0 nbclient==0.9.0 nbconvert==7.16.2 nbformat==5.9.2 nest-asyncio==1.6.0 networkx==3.2.1 newspaper3k==0.2.8 nltk==3.8.1 notebook==7.1.1 notebook_shim==0.2.4 numba==0.59.0 numexpr==2.9.0 numpy==1.24.2 olefile==0.47 ollama==0.1.7 omegaconf==2.3.0 open-interpreter==0.2.0 openai==1.13.4 openapi-schema-pydantic==1.2.4 openapi-schema-validator==0.6.2 openapi-spec-validator==0.7.1 opencv-contrib-python==4.6.0.66 opencv-python==4.6.0.66 opencv-python-headless==4.9.0.80 openpyxl==3.1.2 opt-einsum==3.3.0 orjson==3.9.15 oss2==2.18.4 outcome==1.2.0 overrides==7.7.0 packaging==23.2 paddleocr==2.7.0.3 paddlepaddle-gpu==2.6.1 pandas==1.5.3 pandavro==1.5.2 pandocfilters==1.5.1 parso==0.8.3 partd==1.4.1 pathable==0.4.3 pdf2docx==0.5.8 pdfminer.six==20231228 pdfplumber==0.11.0 peewee==3.17.1 pillow==10.2.0 pipdeptree==2.16.1 platformdirs==3.1.1 pluggy==1.4.0 portalocker==2.8.2 posthog==3.3.4 premailer==3.10.0 preshed==3.0.9 prometheus_client==0.20.0 prompt-toolkit==3.0.43 proto-plus==1.22.3 protobuf==3.20.2 psutil==5.9.8 psycopg2-binary==2.9.9 pure-eval==0.2.2 pyarrow==15.0.0 pyarrow-hotfix==0.6 pyasn1==0.5.1 pyasn1-modules==0.3.0 pyclipper==1.3.0.post5 pycodestyle==2.10.0 pycosat @ file:///C:/b/abs_4b1rrw8pn9/croot/pycosat_1666807711599/work pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work pycryptodome==3.19.1 pydantic==2.6.0 pydantic_core==2.16.1 pydeck==0.8.1b0 pydocstyle==6.3.0 pydub==0.25.1 pyflakes==3.0.1 Pygments==2.17.2 PyJWT==2.8.0 pylint==2.17.0 PyMuPDF==1.20.2 PyMuPDFb==1.23.22 pyOpenSSL @ file:///opt/conda/conda-bld/pyopenssl_1643788558760/work pyparsing==3.1.1 pypdfium2==4.28.0 pypiwin32==223 pypng==0.20220715.0 pyreadline3==3.4.1 PySocks @ file:///C:/ci_310/pysocks_1642089375450/work pytesseract==0.3.10 pytest==7.3.2 pytest-mock==3.11.1 python-dateutil==2.8.2 python-docx==1.1.0 python-dotenv==1.0.0 python-iso639==2024.2.7 python-json-logger==2.0.7 python-lsp-jsonrpc==1.0.0 python-lsp-server==1.7.2 python-magic==0.4.27 python-multipart==0.0.9 python-pptx==0.6.23 pytoolconfig==1.2.5 pytorch-crf==0.7.2 pytz==2024.1 pywin32==306 pywinpty==2.0.13 PyYAML==6.0.1 pyzmq==25.1.2 qrcode==7.4.2 qtconsole==5.5.1 QtPy==2.4.1 rapidfuzz==3.6.2 rarfile==4.1 readabilipy==0.2.0 readchar==4.0.5 redis==4.5.5 referencing==0.31.1 regex==2023.12.25 replicate==0.22.0 requests==2.31.0 requests-file==2.0.0 resend==0.7.2 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rich==13.7.0 rope==1.7.0 rpds-py==0.18.0 rsa==4.9 ruamel.yaml @ file:///C:/b/abs_30ee5qbthd/croot/ruamel.yaml_1666304562000/work ruamel.yaml.clib @ file:///C:/b/abs_aarblxbilo/croot/ruamel.yaml.clib_1666302270884/work ruff==0.3.0 runs==1.2.2 s3transfer==0.6.2 safetensors==0.4.2 scikit-image==0.22.0 scikit-learn==1.2.2 scipy==1.12.0 selenium==4.8.3 semantic-version==2.10.0 Send2Trash==1.8.2 sentence-transformers==2.5.1 sentencepiece==0.2.0 sentry-sdk==1.39.2 seqeval==1.2.2 sgmllib3k==1.0.0 shapely==2.0.3 shellingham==1.5.4 simplejson==3.19.2 six @ file:///tmp/build/80754af9/six_1644875935023/work smart-open==6.4.0 smmap==5.0.1 sniffio==1.3.0 snowballstemmer==2.2.0 socksio==1.0.0 sortedcontainers==2.4.0 soupsieve==2.5 spacy==3.7.4 spacy-legacy==3.0.12 spacy-loggers==1.0.5 SQLAlchemy==1.4.51 sqlalchemy2-stubs==0.0.2a38 srsly==2.4.8 sse-starlette==2.0.0 stack-data==0.6.3 starlette==0.36.3 streamlit==1.32.1 sympy==1.12 tabulate==0.8.10 tenacity==8.2.2 termcolor==2.4.0 terminado==0.18.0 text2vec==1.2.9 thinc==8.2.3 threadpoolctl==3.3.0 tifffile==2024.2.12 tiktoken==0.4.0 tinycss2==1.2.1 tinysegmenter==0.3 tldextract==5.1.1 tokenizers==0.13.3 tokentrim==0.1.13 toml==0.10.2 tomli==2.0.1 tomlkit==0.12.0 toolz @ file:///C:/b/abs_cfvk6rc40d/croot/toolz_1667464080130/work torch==2.2.1+cu121 torchaudio==2.2.1+cu121 torchvision==0.17.1+cu121 tornado==6.4 tqdm @ file:///C:/b/abs_0axbz66qik/croots/recipe/tqdm_1664392691071/work traitlets==5.14.1 transformers==4.33.2 transformers-stream-generator==0.0.5 trio==0.22.0 trio-websocket==0.10.2 twilio==9.0.0 typeguard==4.1.5 typer==0.9.0 types-protobuf==4.24.0.20240311 types-python-dateutil==2.8.19.20240106 typing==3.7.4.3 typing-inspect==0.9.0 typing_extensions==4.9.0 tzdata==2024.1 ujson==5.7.0 unstructured==0.10.30 uri-template==1.3.0 uritemplate==4.1.1 urllib3 @ file:///C:/b/abs_9bcwxczrvm/croot/urllib3_1673575521331/work uvicorn==0.27.1 validators==0.21.0 vine==5.1.0 visualdl==2.5.3 volatile==2.1.0 wasabi==1.1.2 watchdog==4.0.0 watchfiles==0.21.0 wcwidth==0.2.13 weasel==0.3.4 weaviate-client==3.21.0 webcolors==1.13 webencodings==0.5.1 websocket-client==1.7.0 websockets==11.0.3 Werkzeug==3.0.1 wget==3.2 whatthepatch==1.0.4 widgetsnbextension==4.0.10 wikipedia==1.4.0 win-inet-pton @ file:///C:/ci_310/win_inet_pton_1642658466512/work win32-setctime==1.1.0 wincertstore==0.2 wrapt==1.15.0 wsproto==1.2.0 xlrd==2.0.1 XlsxWriter==3.2.0 xlwt==1.3.0 xmod==1.8.1 xxhash==3.4.1 yapf==0.32.0 yarl==1.9.4 yfinance==0.2.37 zhipuai==1.0.7 zipp==3.17.0 zope.event==5.0 zope.interface==6.2 zstandard==0.18.0

Gaozizhong commented 3 months ago

我也遇到了这个问题,但是仅仅是出现在用streamlit run启动程序的时候

yuxiaobopp commented 3 months ago

收到,未及时回复可能在休假,请谅解。

Gaozizhong commented 3 months ago

我解决了,在全局的python环境中安装一下就可以了