jonfairbanks / local-rag

Ingest files for retrieval augmented generation (RAG) with open-source Large Language Models (LLMs), all without 3rd parties or sensitive data leaving your network.
GNU General Public License v3.0
535 stars 64 forks source link

Error saving upload to disk: [Errno 13] Permission denied #18

Closed ecapit closed 8 months ago

ecapit commented 8 months ago

I am not certain if this is an issue, or just my stupidity!

Environment:

I am getting the following error. As I understand, the docker container localhost is sperate to the WSL localhost.

`Warning: Initial loading of Ollama models failed. You might be hosting Ollama somewhere other than localhost. -- [Errno 99] Cannot assign requested address 2024-02-28 13:29:39,912 - helpers - INFO - Error saving upload to disk: [Errno 13] Permission denied: '/home/appuser/data/x.pdf

Loading files: 0%| | 0/2 [00:00<?, ?file/s] Using default embedding model... Setting up Service Context failed: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like BAAI/bge-large-en-v1.5 is not the path to a directory containing a file named config.json. Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.`

HF was giving 503 maintence mode for a while.

It seems as if I should be running ollama from within the container, which cannot be correct ?

I was initially unable to connect to ollama via http://localhost:11434/, so I did the following, and connected successfully:

Set ollama to listen on WSL eth0 IP: `export OLLAMA_HOST=172.26.214.214:11434

https://github.com/ollama/ollama/blob/main/docs/faq.md#setting-environment-variables-on-linux`

I started looking into the permission issue that the ./data volume mapping was owned by root, and everything else was owned by my local user. E.g:

drwxr-xr-x 9 AIhost AIhost 4096 Feb 28 20:26 . drwxr-xr-x 10 AIhost AIhost 4096 Feb 28 20:25 .. -rw-r--r-- 1 AIhost AIhost 149 Feb 28 20:25 .dockerignore drwxr-xr-x 8 AIhost AIhost 4096 Feb 28 20:25 .git -rw-r--r-- 1 AIhost AIhost 66 Feb 28 20:25 .gitattributes drwxr-xr-x 3 AIhost AIhost 4096 Feb 28 20:25 .github -rw-r--r-- 1 AIhost AIhost 33 Feb 28 20:25 .gitignore drwxr-xr-x 2 AIhost AIhost 4096 Feb 28 20:25 .streamlit -rw-r--r-- 1 AIhost AIhost 998 Feb 28 20:25 Dockerfile -rw-r--r-- 1 AIhost AIhost 35149 Feb 28 20:25 LICENSE -rw-r--r-- 1 AIhost AIhost 292 Feb 28 20:25 Pipfile -rw-r--r-- 1 AIhost AIhost 256223 Feb 28 20:25 Pipfile.lock -rw-r--r-- 1 AIhost AIhost 874 Feb 28 20:25 README.md drwxr-xr-x 3 AIhost AIhost 4096 Feb 28 20:25 components drwxr-xr-x 2 root root 4096 Feb 28 21:01 data -rw-r--r-- 1 AIhost AIhost 10454457 Feb 28 20:25 demo.gif -rw-r--r-- 1 AIhost AIhost 462 Feb 28 20:25 docker-compose.yml drwxr-xr-x 2 AIhost AIhost 4096 Feb 28 20:25 docs -rw-r--r-- 1 AIhost AIhost 443225 Feb 28 20:25 logo.png -rw-r--r-- 1 AIhost AIhost 723 Feb 28 20:25 main.py drwxr-xr-x 2 AIhost AIhost 4096 Feb 28 20:25 utils

So process of elim: sudo chown AIhost:AIhost data

I no longer see the permissions issue.

I should also note that local-rag comes up on a different local IP network verus the eth0 IP of WSL (172.19 // 172.26):

You can now view your Streamlit app in your browser. Network URL: http://172.19.0.2:8501 External URL: http://x.x.x.x:8501 Warning: Initial loading of Ollama models failed. You might be hosting Ollama somewhere other than localhost. -- [Errno 99] Cannot assign requested address Using default embedding model... Setting up Service Context failed: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like BAAI/bge-large-en-v1.5 is not the path to a directory containing a file named config.json. Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'. Loading files: 100%|██████████| 1/1 [03:16<00:00, 197.00s/file]0

I have also tried troubleshooting from within the container.

jonfairbanks commented 8 months ago

Semi-similar to #17, Windows is not well supported yet.

jonfairbanks commented 8 months ago

We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like BAAI/bge-large-en-v1.5 is not the path to a directory containing a file named config.json. Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.

HuggingFace also had some downtime earlier today which resulted in this message. I was not able to run the Docker image in Windows for some time because of this error, but now things are working as expected.

ecapit commented 8 months ago

What is the preffered platform ? Bare metal linux ?

Suggestion

jonfairbanks commented 8 months ago

Linux is preferred but Windows should be working as of the latest version.

As for a notebook version, checkout the original PoC for this app which started as a notebook.

jonfairbanks commented 8 months ago

(Marking this as resolved for now as I can no longer reproduce this after the latest version. Please re-open if you're still seeing issues.)