Spaces:
Sleeping
Sleeping
Updated Dockerfile for Hugging Face Spaces deployment
Browse files- Dockerfile +6 -5
- models/nllb.py +2 -7
Dockerfile
CHANGED
@@ -44,12 +44,13 @@ ENV PATH=${CUDA_HOME}/bin:${PATH}
|
|
44 |
# Optionally set LD_LIBRARY_PATH for CUDA libraries
|
45 |
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
|
46 |
|
47 |
-
# Create cache directory
|
48 |
-
RUN mkdir -p /app
|
|
|
49 |
|
50 |
-
# Set environment variables for
|
51 |
-
ENV HF_HOME=/app
|
52 |
-
ENV TRANSFORMERS_CACHE=/app
|
53 |
|
54 |
# Copy the setup script and requirements file into the container
|
55 |
COPY setup.sh requirements.txt /app/
|
|
|
44 |
# Optionally set LD_LIBRARY_PATH for CUDA libraries
|
45 |
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
|
46 |
|
47 |
+
# Create cache directory
|
48 |
+
RUN mkdir -p /app/cache/huggingface
|
49 |
+
RUN chmod -R 777 /app/cache/huggingface
|
50 |
|
51 |
+
# Set environment variables for cache directory
|
52 |
+
ENV HF_HOME=/app/cache/huggingface
|
53 |
+
ENV TRANSFORMERS_CACHE=/app/cache/huggingface
|
54 |
|
55 |
# Copy the setup script and requirements file into the container
|
56 |
COPY setup.sh requirements.txt /app/
|
models/nllb.py
CHANGED
@@ -21,13 +21,8 @@ def nllb():
|
|
21 |
# Load the tokenizer and model
|
22 |
# Set Hugging Face cache directory
|
23 |
# Ensure the cache directory exists and has the correct permissions
|
24 |
-
|
25 |
-
|
26 |
-
os.makedirs(cache_dir)
|
27 |
-
os.chmod(cache_dir, 0o777)
|
28 |
-
|
29 |
-
os.environ['HF_HOME'] = cache_dir
|
30 |
-
os.environ['TRANSFORMERS_CACHE'] = cache_dir
|
31 |
|
32 |
# Load models
|
33 |
tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-1.3B")
|
|
|
21 |
# Load the tokenizer and model
|
22 |
# Set Hugging Face cache directory
|
23 |
# Ensure the cache directory exists and has the correct permissions
|
24 |
+
os.environ['HF_HOME'] = '/app/cache/huggingface'
|
25 |
+
os.environ['TRANSFORMERS_CACHE'] = '/app/cache/huggingface'
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
# Load models
|
28 |
tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-1.3B")
|