text-generation-webui icon indicating copy to clipboard operation
text-generation-webui copied to clipboard

Docker Install / Transformer Cache issue

Open tilllt opened this issue 1 year ago • 11 comments

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?

  • [X] I have searched the existing issues

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

tilllt avatar Feb 06 '24 18:02 tilllt

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

bartowski1182 avatar Feb 06 '24 23:02 bartowski1182

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 avatar Feb 13 '24 01:02 joshs85

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

joshs85 avatar Feb 13 '24 02:02 joshs85

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

bartowski1182 avatar Feb 13 '24 02:02 bartowski1182

@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

MercenaryIII avatar Feb 13 '24 03:02 MercenaryIII

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

bartowski1182 avatar Feb 13 '24 03:02 bartowski1182

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} 

sergepetit avatar Mar 10 '24 01:03 sergepetit

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

ruckc avatar Mar 11 '24 17:03 ruckc

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

louispaulet avatar Mar 26 '24 11:03 louispaulet

@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.

RanDolphInstability avatar May 03 '24 02:05 RanDolphInstability

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

JonathanTurunen avatar May 07 '24 10:05 JonathanTurunen