Open kzpromo opened 5 months ago
Note that my configuration is Nvidia RTX4090 and Ubuntu 22.04 LTS. If your on a different GPU this post may be informative but will definitely need adjustments.
Tensorflow: pip uninstall tensorflow python3 -m pip install tensorflow[and-cuda]
Pytorch: pip uninstall torch conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
I also needed these: sudo apt install nvidia-cuda-toolkit python3 -m pip install --upgrade pip python3 -m pip install wheel python3 -m pip install --upgrade tensorrt
I then followed a sequence of installs. The first was creating a list of installation requirements for the python files in the localGPT directory. This included a bunch of packages that are not in the recomended requirements.txt for localGPT. It was obtained by running the following commands from within the localGPT folder.
mv requirements.txt requirements_orriginal.txt pip install pipreqs pipreqs --encoding utf-8 "./" --force
I then edited the new requirements.txt to remove the duplicate entries where the same package was listed twice with more than one version. I started by keeping the lower versions. I then installed the newly created requirements.txt
pip install -r requirements.txt
There were still version errors when running the ingest.py and run_localGPT.py. This is where things are a bit grey. I know that I had to downgrade bitsandbytes to 0.42.0
pip install bitsandbytes==0.42.0
I also went back and installed the orrginal requirements.txt to get the known requirements versions correct.
pip install -r requirements_orriginal.txt
At this point I was able to run ingest.py on my documents without error. In my case I edited the constants.py with the following settings. N_GPU_LAYERS = 75 #This is for the model I chose. N_BATCH = 512
MODEL_ID = "TheBloke/OpenHermes-2.5-neural-chat-7B-v3-1-7B-GGUF" MODEL_BASENAME = "openhermes-2.5-neural-chat-7b-v3-1-7b.Q8_0.gguf"
In the prompt_template_utils.py I changed the prompt to a simple one sentence instruction. I also added a line to make sure that the template would always be the llama style
system_prompt = """You are Alex an honest insightful empathetic AA mentor that exists to alcoholics stay sober and always responds.\n"""
Notice the prompt_template_type = 'llama' I wanted it static so that the because I auto start the run_localGPT_API.py as a systemd service. def get_prompt_template(system_prompt=system_prompt, promptTemplate_type=None, history=False): prompt_template_type = 'llama' if promptTemplate_type == "llama":
That is pretty much it. Hope this is helpful for someone and contributes to the livelihood of PromptEngineer.
As a last effort to be helpful here is a listing of all of my installed packages as they are in my current functional environment.
packages in environment at ~/miniconda3/envs/localGPT: This is a working set of packages installed in a conda env that only includes the packages necessary for my system and localGPT. I have a Nvidia RTX4090 and Ubuntu 22.04LTS. -NameVersion BuildChannel _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_kmp_llvm conda-forge aiohttp 3.9.5 pypi_0 pypi aiosignal 1.3.1 pypi_0 pypi altair 5.3.0 pypi_0 pypi antlr4-python3-runtime 4.9.3 pypi_0 pypi anyio 4.4.0 pypi_0 pypi astunparse 1.6.3 pypi_0 pypi async-timeout 4.0.3 pypi_0 pypi auto-gptq 0.6.0 pypi_0 pypi autoawq 0.2.5 pypi_0 pypi autoawq-kernels 0.0.6 pypi_0 pypi backoff 2.2.1 pypi_0 pypi bitsandbytes 0.42.0 pypi_0 pypi blas 2.116 mkl conda-forge blas-devel 3.9.0 16_linux64_mkl conda-forge blinker 1.8.2 pypi_0 pypi brotli-python 1.1.0 py310hc6cd4ac_1 conda-forge bzip2 1.0.8 hd590300_5 conda-forge ca-certificates 2024.6.2 hbcca054_0 conda-forge cachetools 5.3.3 pypi_0 pypi certifi 2024.6.2 pyhd8ed1ab_0 conda-forge cffi 1.16.0 py310h2fee648_0 conda-forge chardet 5.2.0 pypi_0 pypi charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge chroma-hnswlib 0.7.2 pypi_0 pypi chromadb 0.4.6 pypi_0 pypi click 8.1.3 pypi_0 pypi coloredlogs 15.0.1 pypi_0 pypi cryptography 42.0.8 pypi_0 pypi cuda-cudart 12.1.105 0 nvidia cuda-cupti 12.1.105 0 nvidia cuda-libraries 12.1.0 0 nvidia cuda-nvrtc 12.1.105 0 nvidia cuda-nvtx 12.1.105 0 nvidia cuda-opencl 12.5.39 0 nvidia cuda-runtime 12.1.0 0 nvidia cuda-version 12.5 3 nvidia cycler 0.12.1 pypi_0 pypi dataclasses-json 0.5.14 pypi_0 pypi datasets 2.18.0 pypi_0 pypi deprecated 1.2.14 pypi_0 pypi dill 0.3.8 pypi_0 pypi diskcache 5.6.3 pypi_0 pypi docx2txt 0.8 pypi_0 pypi effdet 0.4.1 pypi_0 pypi emoji 2.12.1 pypi_0 pypi et-xmlfile 1.1.0 pypi_0 pypi exceptiongroup 1.2.1 pypi_0 pypi faiss-cpu 1.8.0.post1 pypi_0 pypi fastapi 0.99.1 pypi_0 pypi ffmpeg 4.3 hf484d3e_0 pytorch filelock 3.15.4 pyhd8ed1ab_0 conda-forge filetype 1.2.0 pypi_0 pypi flask 3.0.3 pypi_0 pypi fonttools 4.53.0 pypi_0 pypi freetype 2.12.1 h267a509_2 conda-forge frozenlist 1.4.1 pypi_0 pypi fsspec 2024.2.0 pypi_0 pypi gast 0.6.0 pypi_0 pypi gitdb 4.0.11 pypi_0 pypi gmp 6.3.0 hac33072_2 conda-forge gmpy2 2.1.5 py310hc7909c9_1 conda-forge gnutls 3.6.13 h85f3911_1 conda-forge google-pasta 0.2.0 pypi_0 pypi greenlet 3.0.3 pypi_0 pypi grpcio 1.62.2 pypi_0 pypi h2 4.1.0 pyhd8ed1ab_0 conda-forge h5py 3.11.0 pypi_0 pypi hpack 4.0.0 pyh9f0ad1d_0 conda-forge httptools 0.6.1 pypi_0 pypi huggingface-hub 0.23.4 pypi_0 pypi humanfriendly 10.0 pypi_0 pypi hyperframe 6.0.1 pyhd8ed1ab_0 conda-forge icu 73.2 h59595ed_0 conda-forge idna 3.7 pyhd8ed1ab_0 conda-forge importlib-metadata 6.11.0 pypi_0 pypi importlib-resources 6.4.0 pypi_0 pypi instructorembedding 1.0.1 pypi_0 pypi iopath 0.1.10 pypi_0 pypi itsdangerous 2.2.0 pypi_0 pypi jinja2 3.1.4 pyhd8ed1ab_0 conda-forge joblib 1.4.2 pypi_0 pypi jpeg 9e h166bdaf_2 conda-forge jsonschema 4.22.0 pypi_0 pypi jsonschema-specifications 2023.12.1 pypi_0 pypi keras 3.4.1 pypi_0 pypi kiwisolver 1.4.5 pypi_0 pypi lame 3.100 h166bdaf_1003 conda-forge langchain 0.0.267 pypi_0 pypi langchain-chroma 0.1.2 pypi_0 pypi langdetect 1.0.9 pypi_0 pypi langsmith 0.0.92 pypi_0 pypi layoutparser 0.3.4 pypi_0 pypi lcms2 2.15 hfd0df8a_0 conda-forge ld_impl_linux-64 2.40 hf3520f5_7 conda-forge lerc 4.0.0 h27087fc_0 conda-forge libblas 3.9.0 16_linux64_mkl conda-forge libcblas 3.9.0 16_linux64_mkl conda-forge libclang 18.1.1 pypi_0 pypi libcublas 12.1.0.26 0 nvidia libcufft 11.0.2.4 0 nvidia libcufile 1.10.0.4 0 nvidia libcurand 10.3.6.39 0 nvidia libcusolver 11.4.4.55 0 nvidia libcusparse 12.0.2.55 0 nvidia libdeflate 1.17 h0b41bf4_0 conda-forge libffi 3.4.2 h7f98852_5 conda-forge libgcc-ng 14.1.0 h77fa898_0 conda-forge libgfortran-ng 14.1.0 h69a702a_0 conda-forge libgfortran5 14.1.0 hc5f4f2c_0 conda-forge libgomp 14.1.0 h77fa898_0 conda-forge libhwloc 2.10.0 default_h5622ce7_1001 conda-forge libiconv 1.17 hd590300_2 conda-forge libjpeg-turbo 2.0.0 h9bf148f_0 pytorch liblapack 3.9.0 16_linux64_mkl conda-forge liblapacke 3.9.0 16_linux64_mkl conda-forge libnpp 12.0.2.50 0 nvidia libnsl 2.0.1 hd590300_0 conda-forge libnvjitlink 12.1.105 0 nvidia libnvjpeg 12.1.1.14 0 nvidia libpng 1.6.43 h2797004_0 conda-forge libsqlite 3.46.0 hde9e2c9_0 conda-forge libstdcxx-ng 14.1.0 hc0a3c3a_0 conda-forge libtiff 4.5.0 h6adf6a1_2 conda-forge libuuid 2.38.1 h0b41bf4_0 conda-forge libwebp-base 1.4.0 hd590300_0 conda-forge libxcb 1.13 h7f98852_1004 conda-forge libxml2 2.12.7 hc051c1a_1 conda-forge libzlib 1.2.13 h4ab18f5_6 conda-forge llama-cpp-python 0.2.79 pypi_0 pypi llvm-openmp 15.0.7 h0cdce71_0 conda-forge lxml 5.2.2 pypi_0 pypi markdown 3.6 pypi_0 pypi markdown-it-py 3.0.0 pypi_0 pypi markupsafe 2.1.5 py310h2372a71_0 conda-forge marshmallow 3.21.3 pypi_0 pypi mdurl 0.1.2 pypi_0 pypi mkl 2022.1.0 h84fe81f_915 conda-forge mkl-devel 2022.1.0 ha770c72_916 conda-forge mkl-include 2022.1.0 h84fe81f_915 conda-forge ml-dtypes 0.3.2 pypi_0 pypi monotonic 1.6 pypi_0 pypi mpc 1.3.1 hfe3b2da_0 conda-forge mpfr 4.2.1 h9458935_1 conda-forge mpmath 1.3.0 pyhd8ed1ab_0 conda-forge multidict 6.0.5 pypi_0 pypi multiprocess 0.70.16 pypi_0 pypi mypy-extensions 1.0.0 pypi_0 pypi namex 0.0.8 pypi_0 pypi ncurses 6.5 h59595ed_0 conda-forge nettle 3.6 he412f7d_0 conda-forge networkx 3.3 pyhd8ed1ab_1 conda-forge nltk 3.8.1 pypi_0 pypi numexpr 2.10.1 pypi_0 pypi numpy 1.26.4 py310hb13e2d6_0 conda-forge nvidia-cublas-cu12 12.1.3.1 pypi_0 pypi nvidia-cuda-cupti-cu12 12.1.105 pypi_0 pypi nvidia-cuda-nvrtc-cu12 12.1.105 pypi_0 pypi nvidia-cuda-runtime-cu12 12.1.105 pypi_0 pypi nvidia-cudnn-cu12 8.9.2.26 pypi_0 pypi nvidia-cufft-cu12 11.0.2.54 pypi_0 pypi nvidia-curand-cu12 10.3.2.106 pypi_0 pypi nvidia-cusolver-cu12 11.4.5.107 pypi_0 pypi nvidia-cusparse-cu12 12.1.0.106 pypi_0 pypi nvidia-nccl-cu12 2.18.1 pypi_0 pypi nvidia-nvjitlink-cu12 12.5.82 pypi_0 pypi nvidia-nvtx-cu12 12.1.105 pypi_0 pypi onnx 1.16.1 pypi_0 pypi onnxruntime 1.15.1 pypi_0 pypi openapi-schema-pydantic 1.2.4 pypi_0 pypi opencv-python 4.10.0.84 pypi_0 pypi openh264 2.1.1 h780b84a_0 conda-forge openjpeg 2.5.0 hfec8fc6_2 conda-forge openpyxl 3.1.5 pypi_0 pypi openssl 3.3.1 h4ab18f5_1 conda-forge opt-einsum 3.3.0 pypi_0 pypi optree 0.11.0 pypi_0 pypi orjson 3.10.5 pypi_0 pypi overrides 7.7.0 pypi_0 pypi packaging 23.2 pypi_0 pypi pandas 2.2.2 pypi_0 pypi pdf2image 1.17.0 pypi_0 pypi pdfminer-six 20221105 pypi_0 pypi pdfplumber 0.10.4 pypi_0 pypi pikepdf 9.0.0 pypi_0 pypi pillow 10.4.0 pypi_0 pypi pip 24.1.1 pypi_0 pypi portalocker 2.10.0 pypi_0 pypi posthog 3.5.0 pypi_0 pypi protobuf 3.20.2 pypi_0 pypi psutil 6.0.0 pypi_0 pypi pthread-stubs 0.4 h36c2ea0_1001 conda-forge pulsar-client 3.5.0 pypi_0 pypi pyarrow 16.1.0 pypi_0 pypi pyarrow-hotfix 0.6 pypi_0 pypi pycocotools 2.0.8 pypi_0 pypi pycparser 2.22 pyhd8ed1ab_0 conda-forge pydantic 1.10.17 pypi_0 pypi pydeck 0.9.1 pypi_0 pypi pygments 2.18.0 pypi_0 pypi pyparsing 3.1.2 pypi_0 pypi pypdfium2 4.30.0 pypi_0 pypi pypika 0.48.9 pypi_0 pypi pysocks 1.7.1 pyha2e5f31_6 conda-forge pytesseract 0.3.10 pypi_0 pypi python 3.10.0 h543edf9_3_cpython conda-forge python-dateutil 2.9.0.post0 pypi_0 pypi python-dotenv 1.0.1 pypi_0 pypi python-iso639 2024.4.27 pypi_0 pypi python-magic 0.4.27 pypi_0 pypi python_abi 3.10 4_cp310 conda-forge pytorch 2.3.1 py3.10_cuda12.1_cudnn8.9.2_0 pytorch pytorch-cuda 12.1 ha16c6d3_5 pytorch pytorch-mutex 1.0 cuda pytorch pytz 2024.1 pypi_0 pypi pyyaml 6.0.1 py310h2372a71_1 conda-forge rapidfuzz 3.9.3 pypi_0 pypi readline 8.2 h8228510_1 conda-forge referencing 0.35.1 pypi_0 pypi regex 2024.5.15 pypi_0 pypi requests 2.32.3 pyhd8ed1ab_0 conda-forge rich 13.7.1 pypi_0 pypi rouge 1.0.1 pypi_0 pypi rpds-py 0.18.1 pypi_0 pypi safetensors 0.4.3 pypi_0 pypi scikit-learn 1.5.0 pypi_0 pypi scipy 1.14.0 pypi_0 pypi sentencepiece 0.2.0 pypi_0 pypi setuptools 70.1.1 pyhd8ed1ab_0 conda-forge six 1.16.0 pypi_0 pypi smmap 5.0.1 pypi_0 pypi sniffio 1.3.1 pypi_0 pypi soupsieve 2.5 pypi_0 pypi sqlite 3.46.0 h6d4b2fc_0 conda-forge starlette 0.27.0 pypi_0 pypi streamlit 1.29.0 pypi_0 pypi streamlit-extras 0.0.9 pypi_0 pypi sympy 1.12.1 pypyh2585a3b_103 conda-forge tabulate 0.9.0 pypi_0 pypi tbb 2021.12.0 h297d8ca_1 conda-forge tenacity 8.4.2 pypi_0 pypi tensorboard 2.16.2 pypi_0 pypi tensorboard-data-server 0.7.2 pypi_0 pypi tensorflow 2.16.2 pypi_0 pypi tensorflow-io-gcs-filesystem 0.37.1 pypi_0 pypi tensorrt 10.1.0 pypi_0 pypi tensorrt-cu12 10.1.0 pypi_0 pypi tensorrt-cu12-bindings 10.1.0 pypi_0 pypi tensorrt-cu12-libs 10.1.0 pypi_0 pypi termcolor 2.4.0 pypi_0 pypi threadpoolctl 3.5.0 pypi_0 pypi timm 1.0.7 pypi_0 pypi tk 8.6.13 noxft_h4845f30_101 conda-forge tokenizers 0.19.1 pypi_0 pypi toml 0.10.2 pypi_0 pypi toolz 0.12.1 pypi_0 pypi torchaudio 2.3.1 py310_cu121 pytorch torchtriton 2.3.1 py310 pytorch torchvision 0.18.1 pypi_0 pypi tornado 6.4.1 pypi_0 pypi tqdm 4.66.4 pypi_0 pypi transformers 4.42.3 pypi_0 pypi triton 2.1.0 pypi_0 pypi typing-inspect 0.9.0 pypi_0 pypi typing_extensions 4.12.2 pyha770c72_0 conda-forge tzdata 2024.1 pypi_0 pypi tzlocal 5.2 pypi_0 pypi unstructured 0.11.2 pypi_0 pypi unstructured-inference 0.7.15 pypi_0 pypi unstructured-pytesseract 0.3.12 pypi_0 pypi urllib3 2.2.2 pyhd8ed1ab_1 conda-forge uvicorn 0.30.1 pypi_0 pypi uvloop 0.19.0 pypi_0 pypi validators 0.29.0 pypi_0 pypi watchdog 4.0.1 pypi_0 pypi watchfiles 0.22.0 pypi_0 pypi werkzeug 3.0.3 pypi_0 pypi wheel 0.43.0 pyhd8ed1ab_1 conda-forge wrapt 1.16.0 pypi_0 pypi xorg-libxau 1.0.11 hd590300_0 conda-forge xorg-libxdmcp 1.1.3 h7f98852_0 conda-forge xxhash 3.4.1 pypi_0 pypi xz 5.2.6 h166bdaf_0 conda-forge yaml 0.2.5 h7f98852_2 conda-forge yarl 1.9.4 pypi_0 pypi zipp 3.19.2 pypi_0 pypi zlib 1.2.13 h4ab18f5_6 conda-forge zstandard 0.22.0 pypi_0 pypi zstd 1.5.6 ha6fb4c9_0 conda-forge
Here is a requirements list of the pypi packages that can be copy pasted into a requrements.txt file and installed using
pip install -r requirements.txt
aiosignal==1.3.1 altair==5.3.0 antlr4-python3-runtime==4.9.3 anyio==4.4.0 astunparse==1.6.3 async-timeout==4.0.3 auto-gptq==0.6.0 autoawq==0.2.5 autoawq-kernels==0.0.6 backoff==2.2.1 bitsandbytes==0.42.0 blinker==1.8.2 cachetools==5.3.3 chardet==5.2.0 chroma-hnswlib==0.7.2 chromadb==0.4.6 click==8.1.3 coloredlogs==15.0.1 cryptography==42.0.8 cycler==0.12.1 dataclasses-json==0.5.14 datasets==2.18.0 deprecated==1.2.14 dill==0.3.8 diskcache==5.6.3 docx2txt==0.8 effdet==0.4.1 emoji==2.12.1 et-xmlfile==1.1.0 exceptiongroup==1.2.1 faiss-cpu==1.8.0.post1 fastapi==0.99.1 filetype==1.2.0 flask==3.0.3 fonttools==4.53.0 frozenlist==1.4.1 fsspec==2024.2.0 gast==0.6.0 gitdb==4.0.11 google-pasta==0.2.0 greenlet==3.0.3 grpcio==1.62.2 h5py==3.11.0 httptools==0.6.1 huggingface-hub==0.23.4 humanfriendly==10 importlib-metadata==6.11.0 importlib-resources==6.4.0 instructorembedding==1.0.1 iopath==0.1.10 itsdangerous==2.2.0 joblib==1.4.2 jsonschema==4.22.0 keras==3.4.1 kiwisolver==1.4.5 langchain==0.0.267 langchain-chroma==0.1.2 langdetect==1.0.9 langsmith==0.0.92 layoutparser==0.3.4 libclang==18.1.1 llama-cpp-python==0.2.79 lxml==5.2.2 markdown==3.6 markdown-it-py==3.0.0 marshmallow==3.21.3 mdurl==0.1.2 ml-dtypes==0.3.2 monotonic==1.6 multidict==6.0.5 multiprocess==0.70.16 mypy-extensions==1.0.0 namex==0.0.8 nltk==3.8.1 numexpr==2.10.1 nvidia-cublas-cu12==12.1.3.1 nvidia-cuda-cupti-cu12==12.1.105 nvidia-cuda-nvrtc-cu12==12.1.105 nvidia-cudnn-cu12==8.9.2.26 nvidia-cufft-cu12==11.0.2.54 nvidia-curand-cu12==10.3.2.106 nvidia-cusolver-cu12==11.4.5.107 nvidia-cusparse-cu12==12.1.0.106 nvidia-nccl-cu12==2.18.1 nvidia-nvjitlink-cu12==12.5.82 nvidia-nvtx-cu12==12.1.105 onnx==1.16.1 onnxruntime==1.15.1 opencv-python==4.10.0.84 openpyxl==3.1.5 opt-einsum==3.3.0 optree==0.11.0 orjson==3.10.5 overrides==7.7.0 packaging==23.2 pandas==2.2.2 pdf2image==1.17.0 pdfminer-six==20221105 pdfplumber==0.10.4 pikepdf==9.0.0 pillow==10.4.0 pip==24.1.1 portalocker==2.10.0 posthog==3.5.0 protobuf==3.20.2 psutil==6.0.0 pulsar-client==3.5.0 pyarrow==16.1.0 pyarrow-hotfix==0.6 pycocotools==2.0.8 pydantic==1.10.17 pydeck==0.9.1 pygments==2.18.0 pyparsing==3.1.2 pypdfium2==4.30.0 pypika==0.48.9 pytesseract==0.3.10 python-dateutil==2.9.0.post0 python-dotenv==1.0.1 python-iso639==2024.4.27 python-magic==0.4.27 pytz==2024.1 rapidfuzz==3.9.3 referencing==0.35.1 regex==2024.5.15 rich==13.7.1 rouge==1.0.1 rpds-py==0.18.1 safetensors==0.4.3 scikit-learn==1.5.0 scipy==1.14.0 sentencepiece==0.2.0 six==1.16.0 smmap==5.0.1 sniffio==1.3.1 soupsieve==2.5 starlette==0.27.0 streamlit==1.29.0 streamlit-extras==0.0.9 tabulate==0.9.0 tenacity==8.4.2 tensorboard==2.16.2 tensorflow==2.16.2 tensorrt==10.1.0 tensorrt-cu12==10.1.0 tensorrt-cu12-bindings==10.1.0 tensorrt-cu12-libs==10.1.0 termcolor==2.4.0 threadpoolctl==3.5.0 timm==1.0.7 tokenizers==0.19.1 toml==0.10.2 toolz==0.12.1 torchvision==0.18.1 tornado==6.4.1 tqdm==4.66.4 transformers==4.42.3 triton==2.1.0 typing-inspect==0.9.0 tzdata==2024.1 tzlocal==5.2 unstructured==0.11.2 unstructured-inference==0.7.15 uvicorn==0.30.1 uvloop==0.19.0 validators==0.29.0 watchdog==4.0.1 watchfiles==0.22.0 werkzeug==3.0.3 wrapt==1.16.0 xxhash==3.4.1 yarl==1.9.4 zipp==3.19.2 zstandard==0.22.0
hello, i have 15 cpu, 30gb ram server when i am trying to run ingest.py cpu mod, i am reciving error like this
in source_documents i have 590 pdf documents (60 mb)