Spaces:
Sleeping
Sleeping
Initial commit
Browse files- Dockerfile +0 -2
- models/download_models.py +4 -2
Dockerfile
CHANGED
|
@@ -23,8 +23,6 @@ RUN pip install --no-cache-dir torch==2.0.1+cpu -f https://download.pytorch.org/
|
|
| 23 |
COPY . /app/
|
| 24 |
|
| 25 |
# ----------- ๋ชจ๋ธ ๋ค์ด๋ก๋ -----------
|
| 26 |
-
# Hugging Face Access Token (from Space Secret)
|
| 27 |
-
ENV HF_TOKEN=$(cat /run/secrets/HF_TOKEN)
|
| 28 |
# transformers ๋ชจ๋ธ ๋ค์ด๋ก๋ ํ ์ด๋ฏธ์ง์ ํฌํจ
|
| 29 |
RUN python /app/models/download_models.py
|
| 30 |
|
|
|
|
| 23 |
COPY . /app/
|
| 24 |
|
| 25 |
# ----------- ๋ชจ๋ธ ๋ค์ด๋ก๋ -----------
|
|
|
|
|
|
|
| 26 |
# transformers ๋ชจ๋ธ ๋ค์ด๋ก๋ ํ ์ด๋ฏธ์ง์ ํฌํจ
|
| 27 |
RUN python /app/models/download_models.py
|
| 28 |
|
models/download_models.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
import os
|
| 2 |
from transformers import AutoTokenizer, AutoModel
|
| 3 |
|
| 4 |
-
token
|
|
|
|
|
|
|
| 5 |
|
| 6 |
models = {
|
| 7 |
'emotion': ('tae898/emoberta-base-ko', './models/emotion-classification-model'),
|
|
@@ -12,6 +14,6 @@ models = {
|
|
| 12 |
for _, (_, path) in models.items():
|
| 13 |
os.makedirs(path, exist_ok=True)
|
| 14 |
|
| 15 |
-
for
|
| 16 |
AutoModel.from_pretrained(name, cache_dir=path, use_auth_token=token)
|
| 17 |
AutoTokenizer.from_pretrained(name, cache_dir=path, use_auth_token=token)
|
|
|
|
| 1 |
import os
|
| 2 |
from transformers import AutoTokenizer, AutoModel
|
| 3 |
|
| 4 |
+
# Hugging Face token from secret file
|
| 5 |
+
with open("/run/secrets/HF_TOKEN", "r") as f:
|
| 6 |
+
token = f.read().strip()
|
| 7 |
|
| 8 |
models = {
|
| 9 |
'emotion': ('tae898/emoberta-base-ko', './models/emotion-classification-model'),
|
|
|
|
| 14 |
for _, (_, path) in models.items():
|
| 15 |
os.makedirs(path, exist_ok=True)
|
| 16 |
|
| 17 |
+
for name, path in models.values():
|
| 18 |
AutoModel.from_pretrained(name, cache_dir=path, use_auth_token=token)
|
| 19 |
AutoTokenizer.from_pretrained(name, cache_dir=path, use_auth_token=token)
|