oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.
GNU Affero General Public License v3.0
40.65k stars 5.31k forks source link

Docker Install / Transformer Cache issue #5457

Closed tilllt closed 1 week ago

tilllt commented 9 months ago

Describe the bug

I am getting this error:

There was a problem when trying to write in your cache folder (/home/app/text-generation-webui/.cache/huggingface/hub). You should set the environment variable TRANSFORMERS_CACHE to a writable directory.

The bind mount in the docker-compose.yml has


volumes:
      - ./cache:/home/app/text-generation-webui/cache

Is there an existing issue for this?

Reproduction

clone repo follow instructions how to start via docker

Screenshot

No response

Logs

text-generation-webui-1  | There was a problem when trying to write in your cache folder (/home/app/text-generation-webui/.cache/huggingface/hub). You should set the environment variable TRANSFORMERS_CACHE to a writable directory.

System Info

Linux 6.5.0-15-generic #15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
bartowski1182 commented 9 months ago

I may be wrong but I know I've had issues trying to mount a folder directly inside the working directory with docker, so you may be better off setting it to /cache and then setting the environment variable

joshs85 commented 9 months ago

I found a workaround.. the folders don't have the correct permissions on them.. just have to chmod them to give the group write permissions

joshs85 commented 9 months ago

This docker config is complete trash. how do I change the host it listens on. By default it listens on 127.0.0.1. I want it to listen on 0.0.0.0

bartowski1182 commented 9 months ago

I would guess you change container port in the .env file

MercenaryIII commented 9 months ago

@joshs85, I also found that chmod on the folders helped.

I encountered a follow-up issue where my browser would not load the web UI (connection keeps getting "reset" while loading). If you're impatient like me, you can add network_mode: host to your docker compose file and restart your container as a temporary workaround.

Disclaimer: To anyone that tries this workaround, please check the Docker docs so you know exactly what you're changing: Host network driver

bartowski1182 commented 9 months ago

I encountered a follow-up issue where my browser would not load the web UI (connection keeps getting "reset" while loading). If you're impatient like me, you can add network_mode: host to your docker compose file and restart your container as a temporary workaround.

Dam that's annoying, haven't had that issue with mine but I use a different set up

sergepetit commented 8 months ago

I also had the problem, some directories had user 1000 as owner. I didnt edit this section in the .env :

# override default app build permissions (handy for deploying to cloud)
#APP_GID=6972
#APP_UID=6972

is it due to that line in the docker-compose.yml which does not have a colon for the the APP_UID:

APP_GID: ${APP_GID:-6972} 
APP_UID: ${APP_UID-6972} 
ruckc commented 8 months ago

This docker config is complete trash. how do I change the host it listens on. By default it listens on 127.0.0.1. I want it to listen on 0.0.0.0

You modify CMD_FLAGS.txt and add --listen and --listen-host 0.0.0.0

louispaulet commented 7 months ago

For anyone stumbling on this weird issue:

Run these commands ON THE HOST SIDE (where you ran your initial git clone):

$ sudo chown -R 6972:6972 ./cache
$ sudo chmod -R 775 ./cache

I spent way too much time trying to change permissions inside the container when the issue was outside of it.

I also recommend to comment the .env file like this:

# Set cache env
#TRANSFORMERS_CACHE=/home/app/text-generation-webui/cache/
HF_HOME=/home/app/text-generation-webui/cache/

To get rid of these annoying warnings:

 FutureWarning: Using `TRANSFORMERS_CACHE` is deprecated and will be removed in v5 of Transformers. Use `HF_HOME` instead.

EDIT :

I also had to do it for logs and models folders:

$ sudo chown -R 6972:6972 ./models
$ sudo chmod -R 775 ./models

$ sudo chown -R 6972:6972 ./logs
$ sudo chmod -R 775 ./logs
RanDolphInstability commented 6 months ago

@louispaulet thank you! this fix is what I needed to get up and running. @sergepetit adding the missing ':' in docker-compose.yml by itself didn't fix the problem even rebuilding from scratch. it took chmod + chown the affected folders to solve it.

JonathanTurunen commented 6 months ago

Thanks, louispaulet for the answers.

If it helps anyone else, I had a different APP_RUNTIME_GID in the .env file since I'd followed the step:

# You can find your current host user group id with the command `id -g`

However, changing the owner and permissions on the following folders also worked for me. Keeping the default ID:

$ sudo chown -R 6972:6972 ./cache
$ sudo chmod -R 775 ./cache

$ sudo chown -R 6972:6972 ./models
$ sudo chmod -R 775 ./models

$ sudo chown -R 6972:6972 ./logs
$ sudo chmod -R 775 ./logs
github-actions[bot] commented 1 week ago

This issue has been closed due to inactivity for 6 months. If you believe it is still relevant, please leave a comment below. You can tag a developer in your comment.