nexusbert commited on
Commit
267160d
·
1 Parent(s): 4c702f6
Files changed (2) hide show
  1. .dockerignore +1 -0
  2. Dockerfile +14 -3
.dockerignore ADDED
@@ -0,0 +1 @@
 
 
1
+ token.txt
Dockerfile CHANGED
@@ -1,9 +1,13 @@
1
  # Base Image
2
  FROM python:3.10-slim
3
 
 
 
 
4
  ENV DEBIAN_FRONTEND=noninteractive \
5
  PYTHONUNBUFFERED=1 \
6
- PYTHONDONTWRITEBYTECODE=1
 
7
 
8
  WORKDIR /code
9
 
@@ -43,8 +47,15 @@ RUN python -c "from transformers import pipeline; pipeline('text-to-speech', mod
43
  && python -c "from transformers import pipeline; pipeline('text-to-speech', model='facebook/mms-tts-yor')"
44
 
45
  # Pre-load N-ATLaS model during build
46
- RUN python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='NCAIR1/N-ATLaS')" \
47
- && python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; import torch; tokenizer = AutoTokenizer.from_pretrained('NCAIR1/N-ATLaS'); model = AutoModelForCausalLM.from_pretrained('NCAIR1/N-ATLaS', torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32, device_map='auto' if torch.cuda.is_available() else None, trust_remote_code=True, low_cpu_mem_usage=True, use_cache=True); print('N-ATLaS model loaded successfully')"
 
 
 
 
 
 
 
48
 
49
  # Copy project files
50
  COPY . .
 
1
  # Base Image
2
  FROM python:3.10-slim
3
 
4
+ # Build argument for Hugging Face token
5
+ ARG HF_TOKEN
6
+
7
  ENV DEBIAN_FRONTEND=noninteractive \
8
  PYTHONUNBUFFERED=1 \
9
+ PYTHONDONTWRITEBYTECODE=1 \
10
+ HF_TOKEN=${HF_TOKEN}
11
 
12
  WORKDIR /code
13
 
 
47
  && python -c "from transformers import pipeline; pipeline('text-to-speech', model='facebook/mms-tts-yor')"
48
 
49
  # Pre-load N-ATLaS model during build
50
+ RUN python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='NCAIR1/N-ATLaS', token='$HF_TOKEN')" \
51
+ && python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; import torch; tokenizer = AutoTokenizer.from_pretrained('NCAIR1/N-ATLaS', token='$HF_TOKEN'); model = AutoModelForCausalLM.from_pretrained('NCAIR1/N-ATLaS', torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32, device_map='auto' if torch.cuda.is_available() else None, trust_remote_code=True, low_cpu_mem_usage=True, use_cache=True, token='$HF_TOKEN'); print('N-ATLaS model loaded successfully')"
52
+
53
+ # Pre-download ASR models (will be lazy-loaded at runtime)
54
+ RUN python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='NCAIR1/Hausa-ASR', token='$HF_TOKEN')" \
55
+ && python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='NCAIR1/Yoruba-ASR', token='$HF_TOKEN')" \
56
+ && python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='NCAIR1/Igbo-ASR', token='$HF_TOKEN')" \
57
+ && python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='NCAIR1/NigerianAccentedEnglish', token='$HF_TOKEN')" \
58
+ && find /models/huggingface -name '*.lock' -delete
59
 
60
  # Copy project files
61
  COPY . .