Windows中使用conda跑清華ChatGLM記錄

官方給出的WSL部署文檔

嘗試在此基礎直接在windows中使用conda配置環(huán)境部署

先拉代碼

git clone https://github.com/THUDM/ChatGLM-6B.git ChatGLM

切換目錄

cd ChatGLM

創(chuàng)建一個新的conda環(huán)境

conda create -n chatglm python=3

激活環(huán)境

conda activate chatglm

安裝項目依賴

pip3 install -r requirements.txt

報錯

Building wheels for collected packages: sentencepiece, ffmpy
  Building wheel for sentencepiece (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\\lib.win-amd64-cpython-311
      creating build\\lib.win-amd64-cpython-311\\sentencepiece
      copying src\\sentencepiece/__init__.py -> build\\lib.win-amd64-cpython-311\\sentencepiece
      copying src\\sentencepiece/_version.py -> build\\lib.win-amd64-cpython-311\\sentencepiece
      copying src\\sentencepiece/sentencepiece_model_pb2.py -> build\\lib.win-amd64-cpython-311\\sentencepiece
      copying src\\sentencepiece/sentencepiece_pb2.py -> build\\lib.win-amd64-cpython-311\\sentencepiece
      running build_ext
      building 'sentencepiece._sentencepiece' extension
      creating build\\temp.win-amd64-cpython-311
      creating build\\temp.win-amd64-cpython-311\\Release
      creating build\\temp.win-amd64-cpython-311\\Release\\src
      creating build\\temp.win-amd64-cpython-311\\Release\\src\\sentencepiece
      "D:\\Program Files\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\include -IC:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\Include "-ID:\\Program Files\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\ATLMFC\\include" "-ID:\\Program Files\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include" "-ID:\\Windows Kits\\10\\include\\10.0.19041.0\\ucrt" "-ID:\\Windows Kits\\10\\include\\10.0.19041.0\\shared" "-ID:\\Windows Kits\\10\\include\\10.0.19041.0\\um" "-ID:\\Windows Kits\\10\\include\\10.0.19041.0\\winrt" "-ID:\\Windows Kits\\10\\include\\10.0.19041.0\\cppwinrt" /EHsc /Tpsrc/sentencepiece/sentencepiece_wrap.cxx /Fobuild\\temp.win-amd64-cpython-311\\Release\\src/sentencepiece/sentencepiece_wrap.obj /std:c++17 /MT /I..\\build\\root\\include
      cl: 命令行 warning D9025 :正在重寫“/MD”(用“/MT”)
      sentencepiece_wrap.cxx
      src/sentencepiece/sentencepiece_wrap.cxx(2822): fatal error C1083: 無法打開包括文件: “sentencepiece_processor.h”: No such file or directory
      error: command 'D:\\\\Program Files\\\\Microsoft Visual Studio\\\\2019\\\\Community\\\\VC\\\\Tools\\\\MSVC\\\\14.29.30037\\\\bin\\\\HostX86\\\\x64\\\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for sentencepiece
  Running setup.py clean for sentencepiece
  Building wheel for ffmpy (setup.py) ... done
  Created wheel for ffmpy: filename=ffmpy-0.3.0-py3-none-any.whl size=4712 sha256=0c4698963f3cc912575b03d93f86d76c8365c63d7997c37e9608980abfe7267b
  Stored in directory: c:\\users\\hu_z\\appdata\\local\\pip\\cache\\wheels\\47\\a0\\29\\b51cefd1cb11f7bd95ec49652e5bda63f17e4718c67280de57
Successfully built ffmpy
Failed to build sentencepiece
Installing collected packages: tokenizers, sentencepiece, rfc3986, pytz, pydub, mpmath, ffmpy, cpm_kernels, websockets, urllib3, uc-micro-py, tzdata, typing-extensions, toolz, sympy, sniffio, six, semantic-version, regex, pyyaml, python-multipart, pyrsistent, pyparsing, protobuf, pillow, packaging, orjson, numpy, networkx, multidict, mdurl, markupsafe, markdown, latex2mathml, kiwisolver, idna, h11, fsspec, frozenlist, fonttools, filelock, entrypoints, cycler, colorama, charset-normalizer, attrs, async-timeout, aiofiles, yarl, tqdm, requests, python-dateutil, pydantic, mdtex2html, markdown-it-py, linkify-it-py, jsonschema, jinja2, contourpy, click, anyio, aiosignal, uvicorn, torch, starlette, pandas, mdit-py-plugins, matplotlib, huggingface-hub, httpcore, aiohttp, transformers, httpx, gradio-client, fastapi, altair, gradio
  Running setup.py install for sentencepiece ... error
  error: subprocess-exited-with-error

  × Running setup.py install for sentencepiece did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      running install
      C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\Lib\\site-packages\\setuptools\\command\\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\\lib.win-amd64-cpython-311
      creating build\\lib.win-amd64-cpython-311\\sentencepiece
      copying src\\sentencepiece/__init__.py -> build\\lib.win-amd64-cpython-311\\sentencepiece
      copying src\\sentencepiece/_version.py -> build\\lib.win-amd64-cpython-311\\sentencepiece
      copying src\\sentencepiece/sentencepiece_model_pb2.py -> build\\lib.win-amd64-cpython-311\\sentencepiece
      copying src\\sentencepiece/sentencepiece_pb2.py -> build\\lib.win-amd64-cpython-311\\sentencepiece
      running build_ext
      building 'sentencepiece._sentencepiece' extension
      creating build\\temp.win-amd64-cpython-311
      creating build\\temp.win-amd64-cpython-311\\Release
      creating build\\temp.win-amd64-cpython-311\\Release\\src
      creating build\\temp.win-amd64-cpython-311\\Release\\src\\sentencepiece
      "D:\\Program Files\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\include -IC:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\Include "-ID:\\Program Files\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\ATLMFC\\include" "-ID:\\Program Files\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include" "-ID:\\Windows Kits\\10\\include\\10.0.19041.0\\ucrt" "-ID:\\Windows Kits\\10\\include\\10.0.19041.0\\shared" "-ID:\\Windows Kits\\10\\include\\10.0.19041.0\\um" "-ID:\\Windows Kits\\10\\include\\10.0.19041.0\\winrt" "-ID:\\Windows Kits\\10\\include\\10.0.19041.0\\cppwinrt" /EHsc /Tpsrc/sentencepiece/sentencepiece_wrap.cxx /Fobuild\\temp.win-amd64-cpython-311\\Release\\src/sentencepiece/sentencepiece_wrap.obj /std:c++17 /MT /I..\\build\\root\\include
      cl: 命令行 warning D9025 :正在重寫“/MD”(用“/MT”)
      sentencepiece_wrap.cxx
      src/sentencepiece/sentencepiece_wrap.cxx(2822): fatal error C1083: 無法打開包括文件: “sentencepiece_processor.h”: No such file or directory
      error: command 'D:\\\\Program Files\\\\Microsoft Visual Studio\\\\2019\\\\Community\\\\VC\\\\Tools\\\\MSVC\\\\14.29.30037\\\\bin\\\\HostX86\\\\x64\\\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> sentencepiece

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

當前使用python版本為3.11.2,嘗試降級python到3.9,新建一個conda環(huán)境

conda deactivate

conda remove -n chatglm --all

conda create -n chatglm python=3.9

conda activate chatglm

pip3 install -r requirements.txt

python ./web_demo.py

報錯

Downloading (…)okenizer_config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 441/441 [00:00<00:00, 157kB/s]
C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\file_download.py:133: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\Hu_Z\\.cache\\huggingface\\hub. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see <https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations>.
To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to see activate developer mode, see this article: <https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development>
  warnings.warn(message)
Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Downloading (…)enization_chatglm.py: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 16.7k/16.7k [00:00<00:00, 3.16MB/s]
'HTTPSConnectionPool(host='cdn-lfs.huggingface.co', port=443): Max retries exceeded with url: /repos/af/61/af61aa6351e76afb5cd67b257f67055118e5057e1f6d9cce1b4c1c566c85cfd9/5e974d9a69c242ce014c88c2b26089270f6198f3c0b700a887666cd3e816f17e?response-content-disposition=attachment%3B+filename*%3DUTF-8%27%27ice_text.model%3B+filename%3D%22ice_text.model%22%3B&Expires=1681267231&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9jZG4tbGZzLmh1Z2dpbmdmYWNlLmNvL3JlcG9zL2FmLzYxL2FmNjFhYTYzNTFlNzZhZmI1Y2Q2N2IyNTdmNjcwNTUxMThlNTA1N2UxZjZkOWNjZTFiNGMxYzU2NmM4NWNmZDkvNWU5NzRkOWE2OWMyNDJjZTAxNGM4OGMyYjI2MDg5MjcwZjYxOThmM2MwYjcwMGE4ODc2NjZjZDNlODE2ZjE3ZT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2ODEyNjcyMzF9fX1dfQ__&Signature=X6f~TgGS2WkpBunvh6wJa2R5daYh43a~2Jsgs3eYwhF12oKfmunjOKPnOzzUGy1X-Ksmhw0z5~KYDN~sITK0n~AIlg7IUwhcGRHFc2EYpYnP2kht97BoOfiGTCyjl2zVi-yLhK8sP0jYN9I~vOrYFl4-93vGAs3h2DtOHHITDazbMJpXyit5bOwURBpd2k4UexsfrygkP4H2c7VMe68JpuUsnhi5zDwasTMOz6PHseY~i7oXYzIcCCiJxqrtSxKTkMMmE8t4ywih3eDDaYuvM7dEwY0S1LDWEDXdly2h1EsTAC52Odsdl~Q549RvhkMI~l48u8CLW2C~7CGMFup4zQ__&Key-Pair-Id=KVTP0A1DKRTAX (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(10054, '遠程主機強迫關閉了 一個現(xiàn)有的連接。', None, 10054, None)))' thrown while requesting GET <https://cdn-lfs.huggingface.co/repos/af/61/af61aa6351e76afb5cd67b257f67055118e5057e1f6d9cce1b4c1c566c85cfd9/5e974d9a69c242ce014c88c2b26089270f6198f3c0b700a887666cd3e816f17e?response-content-disposition=attachment%3B+filename*%3DUTF-8%27%27ice_text.model%3B+filename%3D%22ice_text.model%22%3B&Expires=1681267231&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9jZG4tbGZzLmh1Z2dpbmdmYWNlLmNvL3JlcG9zL2FmLzYxL2FmNjFhYTYzNTFlNzZhZmI1Y2Q2N2IyNTdmNjcwNTUxMThlNTA1N2UxZjZkOWNjZTFiNGMxYzU2NmM4NWNmZDkvNWU5NzRkOWE2OWMyNDJjZTAxNGM4OGMyYjI2MDg5MjcwZjYxOThmM2MwYjcwMGE4ODc2NjZjZDNlODE2ZjE3ZT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2ODEyNjcyMzF9fX1dfQ__&Signature=X6f%7ETgGS2WkpBunvh6wJa2R5daYh43a%7E2Jsgs3eYwhF12oKfmunjOKPnOzzUGy1X-Ksmhw0z5%7EKYDN%7EsITK0n%7EAIlg7IUwhcGRHFc2EYpYnP2kht97BoOfiGTCyjl2zVi-yLhK8sP0jYN9I%7EvOrYFl4-93vGAs3h2DtOHHITDazbMJpXyit5bOwURBpd2k4UexsfrygkP4H2c7VMe68JpuUsnhi5zDwasTMOz6PHseY%7Ei7oXYzIcCCiJxqrtSxKTkMMmE8t4ywih3eDDaYuvM7dEwY0S1LDWEDXdly2h1EsTAC52Odsdl%7EQ549RvhkMI%7El48u8CLW2C%7E7CGMFup4zQ__&Key-Pair-Id=KVTP0A1DKRTAX>
Traceback (most recent call last):
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\connectionpool.py", line 700, in urlopen
    self._prepare_proxy(conn)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\connectionpool.py", line 996, in _prepare_proxy
    conn.connect()
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\connection.py", line 419, in connect
    self.sock = ssl_wrap_socket(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\util\\ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\util\\ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\ssl.py", line 501, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\ssl.py", line 1041, in _create
    self.do_handshake()
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\ssl.py", line 1310, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] 遠程主機強迫關閉了一個現(xiàn)有的連接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\requests\\adapters.py", line 489, in send
    resp = conn.urlopen(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\util\\retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='cdn-lfs.huggingface.co', port=443): Max retries exceeded with url: /repos/af/61/af61aa6351e76afb5cd67b257f67055118e5057e1f6d9cce1b4c1c566c85cfd9/5e974d9a69c242ce014c88c2b26089270f6198f3c0b700a887666cd3e816f17e?response-content-disposition=attachment%3B+filename*%3DUTF-8%27%27ice_text.model%3B+filename%3D%22ice_text.model%22%3B&Expires=1681267231&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9jZG4tbGZzLmh1Z2dpbmdmYWNlLmNvL3JlcG9zL2FmLzYxL2FmNjFhYTYzNTFlNzZhZmI1Y2Q2N2IyNTdmNjcwNTUxMThlNTA1N2UxZjZkOWNjZTFiNGMxYzU2NmM4NWNmZDkvNWU5NzRkOWE2OWMyNDJjZTAxNGM4OGMyYjI2MDg5MjcwZjYxOThmM2MwYjcwMGE4ODc2NjZjZDNlODE2ZjE3ZT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2ODEyNjcyMzF9fX1dfQ__&Signature=X6f~TgGS2WkpBunvh6wJa2R5daYh43a~2Jsgs3eYwhF12oKfmunjOKPnOzzUGy1X-Ksmhw0z5~KYDN~sITK0n~AIlg7IUwhcGRHFc2EYpYnP2kht97BoOfiGTCyjl2zVi-yLhK8sP0jYN9I~vOrYFl4-93vGAs3h2DtOHHITDazbMJpXyit5bOwURBpd2k4UexsfrygkP4H2c7VMe68JpuUsnhi5zDwasTMOz6PHseY~i7oXYzIcCCiJxqrtSxKTkMMmE8t4ywih3eDDaYuvM7dEwY0S1LDWEDXdly2h1EsTAC52Odsdl~Q549RvhkMI~l48u8CLW2C~7CGMFup4zQ__&Key-Pair-Id=KVTP0A1DKRTAX (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(10054, '遠程主機強迫關閉了一個現(xiàn)有的連接。', None, 10054, None)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\\Users\\Hu_Z\\Code\\2023\\ai\\ChatGLM\\web_demo.py", line 5, in <module>
    tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\models\\auto\\tokenization_auto.py", line 679, in from_pretrained
    return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\tokenization_utils_base.py", line 1763, in from_pretrained
    resolved_vocab_files[file_id] = cached_file(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\utils\\hub.py", line 409, in cached_file
    resolved_file = hf_hub_download(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\utils\\_validators.py", line 120, in _inner_fn
    return fn(*args, **kwargs)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\file_download.py", line 1332, in hf_hub_download
    http_get(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\file_download.py", line 505, in http_get
    r = _request_wrapper(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\file_download.py", line 442, in _request_wrapper
    return http_backoff(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\utils\\_http.py", line 145, in http_backoff
    raise err
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\utils\\_http.py", line 129, in http_backoff
    response = requests.request(method=method, url=url, **kwargs)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\requests\\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\requests\\sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\requests\\sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\requests\\adapters.py", line 559, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='cdn-lfs.huggingface.co', port=443): Max retries exceeded with url: /repos/af/61/af61aa6351e76afb5cd67b257f67055118e5057e1f6d9cce1b4c1c566c85cfd9/5e974d9a69c242ce014c88c2b26089270f6198f3c0b700a887666cd3e816f17e?response-content-disposition=attachment%3B+filename*%3DUTF-8%27%27ice_text.model%3B+filename%3D%22ice_text.model%22%3B&Expires=1681267231&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9jZG4tbGZzLmh1Z2dpbmdmYWNlLmNvL3JlcG9zL2FmLzYxL2FmNjFhYTYzNTFlNzZhZmI1Y2Q2N2IyNTdmNjcwNTUxMThlNTA1N2UxZjZkOWNjZTFiNGMxYzU2NmM4NWNmZDkvNWU5NzRkOWE2OWMyNDJjZTAxNGM4OGMyYjI2MDg5MjcwZjYxOThmM2MwYjcwMGE4ODc2NjZjZDNlODE2ZjE3ZT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2ODEyNjcyMzF9fX1dfQ__&Signature=X6f~TgGS2WkpBunvh6wJa2R5daYh43a~2Jsgs3eYwhF12oKfmunjOKPnOzzUGy1X-Ksmhw0z5~KYDN~sITK0n~AIlg7IUwhcGRHFc2EYpYnP2kht97BoOfiGTCyjl2zVi-yLhK8sP0jYN9I~vOrYFl4-93vGAs3h2DtOHHITDazbMJpXyit5bOwURBpd2k4UexsfrygkP4H2c7VMe68JpuUsnhi5zDwasTMOz6PHseY~i7oXYzIcCCiJxqrtSxKTkMMmE8t4ywih3eDDaYuvM7dEwY0S1LDWEDXdly2h1EsTAC52Odsdl~Q549RvhkMI~l48u8CLW2C~7CGMFup4zQ__&Key-Pair-Id=KVTP0A1DKRTAX (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(10054, '遠程主機強迫關閉了一個現(xiàn)有的連接。', None, 10054, None)))

關閉代理,再來一次

能下載了,貌似文件太大,超時了(但是這個模型我已經(jīng)下載過了)

Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Downloading ice_text.model: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2.71M/2.71M [00:00<00:00, 4.45MB/s]
C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\file_download.py:133: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\Hu_Z\\.cache\\huggingface\\hub. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see <https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations>.
To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to see activate developer mode, see this article: <https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development>
  warnings.warn(message)
Downloading (…)lve/main/config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 773/773 [00:00<00:00, 256kB/s]
Explicitly passing a `revision` is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.
Downloading (…)iguration_chatglm.py: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4.28k/4.28k [00:00<00:00, 1.37MB/s]
Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Downloading (…)/modeling_chatglm.py: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 56.6k/56.6k [00:00<00:00, 306kB/s]
Downloading (…)main/quantization.py: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 15.1k/15.1k [00:00<00:00, 1.35MB/s]
Downloading (…)model.bin.index.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 33.4k/33.4k [00:00<00:00, 682kB/s]
Downloading (…)l-00001-of-00008.bin: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.74G/1.74G [02:14<00:00, 12.9MB/s]
Downloading (…)l-00002-of-00008.bin: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.88G/1.88G [02:33<00:00, 12.2MB/s]
Downloading shards:  25%|██████████████████████████████████████                                                                                                                  | 2/8 [06:01<18:04, 180.76s/it]
Traceback (most recent call last):n:  36%|██████████████████████████████████████████████▊                                                                                   | 713M/1.98G [01:00<01:44, 12.1MB/s]
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\response.py", line 444, in _error_catcher
    yield
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\response.py", line 567, in read
    data = self._fp_read(amt) if not fp_closed else b""
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\response.py", line 533, in _fp_read
    return self._fp.read(amt) if amt is not None else self._fp.read()
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\http\\client.py", line 463, in read
    n = self.readinto(b)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\http\\client.py", line 507, in readinto
    n = self.fp.readinto(b)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\ssl.py", line 1242, in recv_into
    return self.read(nbytes, buffer)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\ssl.py", line 1100, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\requests\\models.py", line 816, in generate
    yield from self.raw.stream(chunk_size, decode_content=True)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\response.py", line 628, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\response.py", line 593, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\urllib3\\response.py", line 449, in _error_catcher
    raise ReadTimeoutError(self._pool, None, "Read timed out.")
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='cdn-lfs.huggingface.co', port=443): Read timed out.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\\Users\\Hu_Z\\Code\\2023\\ai\\ChatGLM\\web_demo.py", line 6, in <module>
    model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\models\\auto\\auto_factory.py", line 466, in from_pretrained
    return model_class.from_pretrained(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\modeling_utils.py", line 2410, in from_pretrained
    resolved_archive_file, sharded_metadata = get_checkpoint_shard_files(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\utils\\hub.py", line 925, in get_checkpoint_shard_files
    cached_filename = cached_file(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\utils\\hub.py", line 409, in cached_file
    resolved_file = hf_hub_download(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\utils\\_validators.py", line 120, in _inner_fn
    return fn(*args, **kwargs)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\file_download.py", line 1332, in hf_hub_download
    http_get(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\file_download.py", line 538, in http_get
    for chunk in r.iter_content(chunk_size=10 * 1024 * 1024):
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\requests\\models.py", line 822, in generate
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='cdn-lfs.huggingface.co', port=443): Read timed out.
Downloading (…)l-00003-of-00008.bin:  36%|██████████████████████████████████████████████▊                                                                                   | 713M/1.98G [01:10<02:05, 10.1MB/s]

用自己下載的模型,參考issues

修改web_demo.py

modulesPath = "D:\\Users\\Hu_Z\\Code\\2023\\ai\\ChatGLM\\modules"
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
model = AutoModel.from_pretrained(modulesPath, trust_remote_code=True).half().cuda()
model = model.eval()

將模型文件軟鏈接至D:\Users\Hu_Z\Code\2023\ai\ChatGLM\modules (直接放原文件也可以)

管理員運行powershell,執(zhí)行以下命令

$source = "D:\Users\Hu_Z\Code\2023\語言模型\chatglm-6b"
$destination = "D:\Users\Hu_Z\Code\2023\ai\ChatGLM\modules"

Get-ChildItem -Path $source | ForEach-Object {
    $target = Join-Path $destination $_.Name
    New-Item -ItemType SymbolicLink -Path $target -Target $_.FullName
}

再次啟動 python web_demo.py

報錯

Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Traceback (most recent call last):
  File "C:\Users\Hu_Z\.conda\envs\chatglm\lib\site-packages\transformers\configuration_utils.py", line 628, in _get_config_dict
    resolved_config_file = cached_file(
  File "C:\Users\Hu_Z\.conda\envs\chatglm\lib\site-packages\transformers\utils\hub.py", line 409, in cached_file
    resolved_file = hf_hub_download(
  File "C:\Users\Hu_Z\.conda\envs\chatglm\lib\site-packages\huggingface_hub\utils\_validators.py", line 112, in _inner_fn
    validate_repo_id(arg_value)
  File "C:\Users\Hu_Z\.conda\envs\chatglm\lib\site-packages\huggingface_hub\utils\_validators.py", line 166, in validate_repo_id
    raise HFValidationError(
huggingface_hub.utils._validators.HFValidationError: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: 'D:\Users\Hu_Z\Code3i\ChatGLM\modules'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Users\Hu_Z\Code\2023\ai\ChatGLM\web_demo.py", line 7, in <module>
    model = AutoModel.from_pretrained(modulesPath, trust_remote_code=True).half().cuda()
  File "C:\Users\Hu_Z\.conda\envs\chatglm\lib\site-packages\transformers\models\auto\auto_factory.py", line 441, in from_pretrained
    config, kwargs = AutoConfig.from_pretrained(
  File "C:\Users\Hu_Z\.conda\envs\chatglm\lib\site-packages\transformers\models\auto\configuration_auto.py", line 896, in from_pretrained
    config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "C:\Users\Hu_Z\.conda\envs\chatglm\lib\site-packages\transformers\configuration_utils.py", line 573, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "C:\Users\Hu_Z\.conda\envs\chatglm\lib\site-packages\transformers\configuration_utils.py", line 649, in _get_config_dict
    raise EnvironmentError(
OSError: Can't load the configuration of 'D:\Users\Hu_Z\Code3i\ChatGLM\modules'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'D:\Users\Hu_Z\Code3i\ChatGLM\modules' is the correct path to a directory containing a config.json file

倉庫的所有小文件都下載下來放進module文件里

再次啟動python web_demo.py

報錯

'HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /THUDM/chatglm-6b/resolve/main/tokenizer_config.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000021E32E69AC0>, 'Connection to huggingface.co timed out. (connect timeout=10)'))' thrown while requesting HEAD <https://huggingface.co/THUDM/chatglm-6b/resolve/main/tokenizer_config.json>
Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
'HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /THUDM/chatglm-6b/resolve/main/tokenization_chatglm.py (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000021E32A66040>, 'Connection to huggingface.co timed out. (connect timeout=10)'))' thrown while requesting HEAD <https://huggingface.co/THUDM/chatglm-6b/resolve/main/tokenization_chatglm.py>
Traceback (most recent call last):
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\configuration_utils.py", line 628, in _get_config_dict
    resolved_config_file = cached_file(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\utils\\hub.py", line 409, in cached_file
    resolved_file = hf_hub_download(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\utils\\_validators.py", line 112, in _inner_fn
    validate_repo_id(arg_value)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\utils\\_validators.py", line 166, in validate_repo_id
    raise HFValidationError(
huggingface_hub.utils._validators.HFValidationError: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: 'D:\\Users\\Hu_Z\\Code3i\\ChatGLM\\modules'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\\Users\\Hu_Z\\Code\\2023\\ai\\ChatGLM\\web_demo.py", line 7, in <module>
    model = AutoModel.from_pretrained(modulesPath, trust_remote_code=True).half().cuda()
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\models\\auto\\auto_factory.py", line 441, in from_pretrained
    config, kwargs = AutoConfig.from_pretrained(
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\models\\auto\\configuration_auto.py", line 896, in from_pretrained
    config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\configuration_utils.py", line 573, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\configuration_utils.py", line 649, in _get_config_dict
    raise EnvironmentError(
OSError: Can't load the configuration of 'D:\\Users\\Hu_Z\\Code3i\\ChatGLM\\modules'. If you were trying to load it from '<https://huggingface.co/models>', make sure you don't have a local directory with the same name. Otherwise, make sure 'D:\\Users\\Hu_Z\\Code3i\\ChatGLM\\modules' is the correct path to a directory containing a config.json file
(chatglm) PS D:\\Users\\Hu_Z\\Code\\2023\\ai\\ChatGLM> python .\\web_demo.py
Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a `revision` is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:08<00:00,  1.01s/it]
Traceback (most recent call last):
  File "D:\\Users\\Hu_Z\\Code\\2023\\ai\\ChatGLM\\web_demo.py", line 7, in <module>
    model = AutoModel.from_pretrained(modulesPath, trust_remote_code=True).half().cuda()
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\torch\\nn\\modules\\module.py", line 905, in cuda
    return self._apply(lambda t: t.cuda(device))
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\torch\\nn\\modules\\module.py", line 797, in _apply
    module._apply(fn)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\torch\\nn\\modules\\module.py", line 797, in _apply
    module._apply(fn)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\torch\\nn\\modules\\module.py", line 820, in _apply
    param_applied = fn(param)
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\torch\\nn\\modules\\module.py", line 905, in <lambda>
    return self._apply(lambda t: t.cuda(device))
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\torch\\cuda\\__init__.py", line 239, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

查詢驅(qū)動信息nvidia-smi

(chatglm) PS D:\Users\Hu_Z\Code\2023\ai\ChatGLM> nvidia-smi
Mon Apr 10 22:04:08 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 531.41                 Driver Version: 531.41       CUDA Version: 12.1     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                      TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf            Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 2080 Ti    WDDM | 00000000:02:00.0  On |                  N/A |
| 34%   46C    P8               11W / 250W|   1579MiB / 22528MiB |     10%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

當前電腦顯卡是RTX 2080ti,已經(jīng)裝過cuda驅(qū)動了,所以可能是pytorch的問題(正好最近有遇到類似的問題)

import torch
torch.cuda.is_available()
# 返回False
# 如果識別到顯卡的話,是要返回True的

# 查看pytorch版本
conda list pytorch

# 發(fā)現(xiàn)返回空了
# packages in environment at C:\\Users\\Hu_Z\\.conda\\envs\\chatglm:
#
# Name                    Version                   Build  Channel

# 安裝pytorch
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
conda install -c anaconda cudatoolkit

conda list pytorch
pytorch                   2.0.0           py3.9_cuda11.8_cudnn8_0    pytorch
pytorch-cuda              11.8                 h24eeafa_3    pytorch
pytorch-mutex             1.0                        cuda    pytorch

cudatoolkit               11.3.1               h59b6b97_2    anaconda

再次啟動python web_demo.py

報錯

Traceback (most recent call last):
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\requests\\compat.py", line 11, in <module>
    import chardet
ModuleNotFoundError: No module named 'chardet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\\Users\\Hu_Z\\Code\\2023\\ai\\ChatGLM\\web_demo.py", line 1, in <module>
    from transformers import AutoModel, AutoTokenizer
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\__init__.py", line 26, in <module>
    from . import dependency_versions_check
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\dependency_versions_check.py", line 17, in <module>
    from .utils.versions import require_version, require_version_core
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\utils\\__init__.py", line 30, in <module>
    from .generic import (
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\utils\\generic.py", line 29, in <module>
    from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\utils\\import_utils.py", line 32, in <module>
    from . import logging
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\transformers\\utils\\logging.py", line 35, in <module>
    import huggingface_hub.utils as hf_hub_utils
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\utils\\__init__.py", line 32, in <module>
    from ._errors import (
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\huggingface_hub\\utils\\_errors.py", line 3, in <module>
    from requests import HTTPError, Response
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\requests\\__init__.py", line 45, in <module>
    from .exceptions import RequestsDependencyWarning
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\requests\\exceptions.py", line 9, in <module>
    from .compat import JSONDecodeError as CompatJSONDecodeError
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\requests\\compat.py", line 13, in <module>
    import charset_normalizer as chardet
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\charset_normalizer\\__init__.py", line 23, in <module>
    from charset_normalizer.api import from_fp, from_path, from_bytes, normalize
  File "C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\charset_normalizer\\api.py", line 10, in <module>
    from charset_normalizer.md import mess_ratio
  File "charset_normalizer\\md.py", line 5, in <module>
ImportError: cannot import name 'COMMON_SAFE_ASCII_CHARACTERS' from 'charset_normalizer.constant' (C:\\Users\\Hu_Z\\.conda\\envs\\chatglm\\lib\\site-packages\\charset_normalizer\\constant.py)

安裝 chardet(使用代理) pip install --proxy=http://127.0.0.1:7890 chardet

再次啟動python web_demo.py

pip install --proxy=http://127.0.0.1:7890 cchardet

再次啟動python web_demo.py

Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a `revision` is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:08<00:00,  1.05s/it]
Running on local URL:  http://127.0.0.1:7861

Could not create share link. Please check your internet connection or our status page: https://status.gradio.app

終于跑起來了

(從notion copy過來的,好多符號自動加轉(zhuǎn)義或者其它問題。。。)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容