Langchain-Chatchat icon indicating copy to clipboard operation
Langchain-Chatchat copied to clipboard

希望出一个macos m2的安装教程

Open tang-jianghua opened this issue 2 years ago • 3 comments

mac m2安装,模型加载成功了,知识库文件也上传成功了,但是一问答就会报错,报错内容如下

  File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/gradio/routes.py", line 437, in run_predict
    output = await app.get_blocks().process_api(
  File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/gradio/blocks.py", line 1346, in process_api
    result = await self.call_function(
  File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/gradio/blocks.py", line 1090, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/gradio/utils.py", line 341, in async_iteration
    return await iterator.__anext__()
  File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/gradio/utils.py", line 334, in __anext__
    return await anyio.to_thread.run_sync(
  File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/gradio/utils.py", line 317, in run_sync_iterator_async
    return next(iterator)
  File "/Users/tangjianghua5/projects/ai/langchain-ChatGLM/webui.py", line 55, in get_answer
    for resp, history in local_doc_qa.get_knowledge_based_answer(
  File "/Users/tangjianghua5/projects/ai/langchain-ChatGLM/chains/local_doc_qa.py", line 227, in get_knowledge_based_answer
    related_docs_with_score = vector_store.similarity_search_with_score(query, k=self.top_k)
  File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/langchain/vectorstores/faiss.py", line 245, in similarity_search_with_score
    docs = self.similarity_search_with_score_by_vector(
TypeError: MyFAISS.similarity_search_with_score_by_vector() got an unexpected keyword argument 'filter' 

tang-jianghua avatar Jun 14 '23 03:06 tang-jianghua

我也是一样,我也是mac arm架构的

qq742464260 avatar Jun 14 '23 03:06 qq742464260

mac arm安装报错求大神帮助:

$ pip install --use-pep517 -r requirements.txt 


Building wheels for collected packages: onnx
  Building wheel for onnx (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for onnx (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [86 lines of output]
      fatal: not a git repository (or any of the parent directories): .git
      running bdist_wheel
      running build
      running build_py
      running create_version
      running cmake_build
      Using cmake args: ['/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/bin/cmake', '-DPYTHON_INCLUDE_DIR=/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/include/python3.10', '-DPYTHON_EXECUTABLE=/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/bin/python', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cpython-310-darwin.so', '-DCMAKE_BUILD_TYPE=Release', '-DONNX_ML=1', '/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-install-hf8luq8_/onnx_a7831cd3a4664f3098b93458710ac2c7']
      -- The C compiler identification is AppleClang 14.0.3.14030022
      -- The CXX compiler identification is AppleClang 14.0.3.14030022
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found PythonInterp: /Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/bin/python (found version "3.10.11")
      -- Found PythonLibs: /Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/libpython3.10.dylib (found version "3.10.11")
      Generated: /private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-install-hf8luq8_/onnx_a7831cd3a4664f3098b93458710ac2c7/.setuptools-cmake-build/onnx/onnx-ml.proto
      CMake Error at CMakeLists.txt:299 (message):
        Protobuf compiler not found
      Call Stack (most recent call first):
        CMakeLists.txt:330 (relative_protobuf_generate_cpp)
      
      
      -- Configuring incomplete, errors occurred!
      See also "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-install-hf8luq8_/onnx_a7831cd3a4664f3098b93458710ac2c7/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
      See also "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-install-hf8luq8_/onnx_a7831cd3a4664f3098b93458710ac2c7/.setuptools-cmake-build/CMakeFiles/CMakeError.log".
      Traceback (most recent call last):
        File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 416, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 332, in <module>
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 343, in run
          self.run_command("build")
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 223, in run
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-build-env-bgidsg72/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 209, in run
        File "/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/bin/cmake', '-DPYTHON_INCLUDE_DIR=/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/include/python3.10', '-DPYTHON_EXECUTABLE=/Users/tangjianghua5/miniconda3/envs/langchain-ChatGLM/bin/python', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cpython-310-darwin.so', '-DCMAKE_BUILD_TYPE=Release', '-DONNX_ML=1', '/private/var/folders/tc/3lqshyjx3d5bsfvxdlbsm2g00000gp/T/pip-install-hf8luq8_/onnx_a7831cd3a4664f3098b93458710ac2c7']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for onnx
Failed to build onnx
ERROR: Could not build wheels for onnx, which is required to install pyproject.toml-based projects

tang-jianghua avatar Jun 14 '23 06:06 tang-jianghua

安装没有报错,执行python cli_demo.py报错 python cli_demo.py INFO 2023-06-14 14:58:51,880-1d: loading model config llm device: mps embedding device: mps dir: /Users/wyb/Projects/ai/langchain-ChatGLM flagging username: b2bc852c79c74ce98c6baca5acc8b2e1

INFO 2023-06-14 14:59:04,244-1d: NumExpr defaulting to 8 threads. /Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/pkg_resources/init.py:121: DeprecationWarning: pkg_resources is deprecated as an API warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning) /Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('mpl_toolkits'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('google'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('zope'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/lmdb/pycache/lmdb_cffi.c:267:14: fatal error: 'lmdb.h' file not found #include "lmdb.h" ^~~~~~~~ 1 error generated. Traceback (most recent call last): File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/lmdb/init.py", line 42, in from lmdb.cpython import * ImportError: dlopen(/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/lmdb/cpython.cpython-310-darwin.so, 0x0002): tried: '/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/lmdb/cpython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/lmdb/cpython.cpython-310-darwin.so' (no such file), '/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/lmdb/cpython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py", line 185, in _compile self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs) File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py", line 1041, in spawn spawn(cmd, dry_run=self.dry_run, **kwargs) File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/_distutils/spawn.py", line 70, in spawn raise DistutilsExecError( distutils.errors.DistutilsExecError: command '/usr/bin/clang' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/cffi/ffiplatform.py", line 51, in _build dist.run_command('build_ext') File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/dist.py", line 1244, in run_command super().run_command(command) File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run _build_ext.run(self) File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run self.build_extensions() File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions _build_ext.build_ext.build_extensions(self) File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions self._build_extensions_serial() File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial self.build_extension(ext) File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 246, in build_extension _build_ext.build_extension(self, ext) File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension objects = self.compiler.compile( File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py", line 600, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py", line 187, in _compile raise CompileError(msg) distutils.errors.CompileError: command '/usr/bin/clang' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/wyb/Projects/ai/langchain-ChatGLM/cli_demo.py", line 2, in from chains.local_doc_qa import LocalDocQA File "/Users/wyb/Projects/ai/langchain-ChatGLM/chains/local_doc_qa.py", line 11, in from loader import UnstructuredPaddleImageLoader, UnstructuredPaddlePDFLoader File "/Users/wyb/Projects/ai/langchain-ChatGLM/loader/init.py", line 1, in from .image_loader import UnstructuredPaddleImageLoader File "/Users/wyb/Projects/ai/langchain-ChatGLM/loader/image_loader.py", line 5, in from paddleocr import PaddleOCR File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/paddleocr/init.py", line 14, in from .paddleocr import * File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/paddleocr/paddleocr.py", line 37, in from tools.infer import predict_system File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/paddleocr/tools/infer/predict_system.py", line 33, in import tools.infer.predict_det as predict_det File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/paddleocr/tools/infer/predict_det.py", line 31, in from ppocr.data import create_operators, transform File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/paddleocr/ppocr/data/init.py", line 37, in from ppocr.data.lmdb_dataset import LMDBDataSet, LMDBDataSetSR File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/paddleocr/ppocr/data/lmdb_dataset.py", line 17, in import lmdb File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/lmdb/init.py", line 48, in from lmdb.cffi import * File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/lmdb/cffi.py", line 372, in _lib = _ffi.verify(_CFFI_VERIFY, File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/cffi/api.py", line 468, in verify lib = self.verifier.load_library() File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/cffi/verifier.py", line 105, in load_library self._compile_module() File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/cffi/verifier.py", line 202, in _compile_module outputfilename = ffiplatform.compile(tmpdir, self.get_extension()) File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/cffi/ffiplatform.py", line 22, in compile outputfilename = _build(tmpdir, ext, compiler_verbose, debug) File "/Users/wyb/miniconda3/envs/lc-glm/lib/python3.10/site-packages/cffi/ffiplatform.py", line 58, in _build raise VerificationError('%s: %s' % (e.class.name, e)) cffi.VerificationError: CompileError: command '/usr/bin/clang' failed with exit code 1

bosir avatar Jun 14 '23 07:06 bosir

langchain版本不对,按照requirements.txt的版本装

zorionginn avatar Jun 19 '23 23:06 zorionginn

我M2成功运行了,不过出文字速度感人

EwingYangs avatar Jun 25 '23 01:06 EwingYangs

咋搞的兄弟

qq742464260 avatar Jun 25 '23 07:06 qq742464260

langchain版本不对,按照requirements.txt的版本装

Mac M1的一直提示模型未加载成功,点击对话,就报AttributeError: 'NoneType' object has no attribute 'int4WeightExtractionHalf'这个异常,也是因为都要按照requirements的安装吗?我看介绍Mac的torch不是要安装night版本的吗?

Veken avatar Jun 26 '23 06:06 Veken

langchain版本不对,按照requirements.txt的版本装

Mac M1的一直提示模型未加载成功,点击对话,就报AttributeError: 'NoneType' object has no attribute 'int4WeightExtractionHalf'这个异常,也是因为都要按照requirements的安装吗?我看介绍Mac的torch不是要安装night版本的吗?

没有遇到这个错误,优先按照requirements安装。 但是q5.1的LLaMA 7秒出一个token,你再考虑一下还有没有继续搞的必要...

zorionginn avatar Jun 27 '23 03:06 zorionginn

(aifin) huangying@MacBook-Pro-2 aifin % python api.py INFO 2023-07-05 19:25:26,058-1d: loading model config llm device: mps embedding device: cpu dir: /Users/huangying/PycharmProjects/aifin flagging username: 617558d9d64b46728a67b2bbc80f1091

/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/pkg_resources/init.py:121: DeprecationWarning: pkg_resources is deprecated as an API warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning) /Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('google'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('google.logging'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/pkg_resources/init.py:2349: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('google'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(parent) /Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('mpl_toolkits'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('zope'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) /Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/lmdb/pycache/lmdb_cffi.c:267:14: fatal error: 'lmdb.h' file not found #include "lmdb.h" ^~~~~~~~ 1 error generated. Traceback (most recent call last): File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/lmdb/init.py", line 42, in from lmdb.cpython import * ImportError: dlopen(/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/lmdb/cpython.cpython-310-darwin.so, 0x0002): tried: '/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/lmdb/cpython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py", line 185, in _compile self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs) File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py", line 1041, in spawn spawn(cmd, dry_run=self.dry_run, **kwargs) File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/_distutils/spawn.py", line 70, in spawn raise DistutilsExecError( distutils.errors.DistutilsExecError: command '/usr/bin/clang' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/cffi/ffiplatform.py", line 51, in _build dist.run_command('build_ext') File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/dist.py", line 1244, in run_command super().run_command(command) File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run _build_ext.run(self) File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run self.build_extensions() File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions _build_ext.build_ext.build_extensions(self) File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions self._build_extensions_serial() File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial self.build_extension(ext) File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 246, in build_extension _build_ext.build_extension(self, ext) File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension objects = self.compiler.compile( File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py", line 600, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py", line 187, in _compile raise CompileError(msg) distutils.errors.CompileError: command '/usr/bin/clang' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/huangying/PycharmProjects/aifin/api.py", line 17, in from chains.local_doc_qa import LocalDocQA File "/Users/huangying/PycharmProjects/aifin/chains/local_doc_qa.py", line 11, in from loader import UnstructuredPaddleImageLoader, UnstructuredPaddlePDFLoader File "/Users/huangying/PycharmProjects/aifin/loader/init.py", line 1, in from .image_loader import UnstructuredPaddleImageLoader File "/Users/huangying/PycharmProjects/aifin/loader/image_loader.py", line 5, in from paddleocr import PaddleOCR File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/paddleocr/init.py", line 14, in from .paddleocr import * File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/paddleocr/paddleocr.py", line 37, in from tools.infer import predict_system File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/paddleocr/tools/infer/predict_system.py", line 33, in import tools.infer.predict_det as predict_det File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/paddleocr/tools/infer/predict_det.py", line 31, in from ppocr.data import create_operators, transform File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/paddleocr/ppocr/data/init.py", line 37, in from ppocr.data.lmdb_dataset import LMDBDataSet, LMDBDataSetSR File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/paddleocr/ppocr/data/lmdb_dataset.py", line 17, in import lmdb File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/lmdb/init.py", line 48, in from lmdb.cffi import * File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/lmdb/cffi.py", line 372, in _lib = _ffi.verify(_CFFI_VERIFY, File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/cffi/api.py", line 468, in verify lib = self.verifier.load_library() File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/cffi/verifier.py", line 105, in load_library self._compile_module() File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/cffi/verifier.py", line 202, in _compile_module outputfilename = ffiplatform.compile(tmpdir, self.get_extension()) File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/cffi/ffiplatform.py", line 22, in compile outputfilename = _build(tmpdir, ext, compiler_verbose, debug) File "/Users/huangying/miniconda3/envs/aifin/lib/python3.10/site-packages/cffi/ffiplatform.py", line 58, in _build raise VerificationError('%s: %s' % (e.class.name, e)) cffi.VerificationError: CompileError: command '/usr/bin/clang' failed with exit code 1 (aifin) huangying@MacBook-Pro-2 aifin % 这个错误解决了吗?

hy928302776 avatar Jul 05 '23 11:07 hy928302776

你们是用docker安装的吗? docker image inspect registry.cn-beijing.aliyuncs.com/chatchat/chatchat:0.2.0,我看这个镜像只支持amd吧。

yudidi avatar Aug 27 '23 05:08 yudidi

langchain版本不对,按照requirements.txt的版本装

Mac M1的一直提示模型未加载成功,点击对话,就报AttributeError: 'NoneType' object has no attribute 'int4WeightExtractionHalf'这个异常,也是因为都要按照requirements的安装吗?我看介绍Mac的torch不是要安装night版本的吗?

我也是,如何解决

black-fruit avatar Dec 10 '23 12:12 black-fruit