masanorihirano
commited on
Commit
•
0e9fa83
1
Parent(s):
d6c0cbe
update
Browse files- Dockerfile +9 -6
- app.py +2 -2
- model_pull.py +2 -2
Dockerfile
CHANGED
@@ -14,8 +14,14 @@ RUN sed -i 's http://deb.debian.org http://cdn-aws.deb.debian.org g' /etc/apt/so
|
|
14 |
python3.9-dev && \
|
15 |
rm -rf /var/lib/apt/lists/* && \
|
16 |
git lfs install
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
RUN curl https://pyenv.run | bash
|
18 |
-
ENV PYENV_ROOT /
|
19 |
ENV PATH ${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}
|
20 |
RUN eval "$(pyenv init -)" && \
|
21 |
eval "$(pyenv virtualenv-init -)" && \
|
@@ -25,14 +31,11 @@ RUN eval "$(pyenv init -)" && \
|
|
25 |
pip install --no-cache-dir --upgrade pip==22.3.1 setuptools wheel && \
|
26 |
pip install --no-cache-dir datasets "huggingface-hub>=0.12.1" "protobuf<4" "click<8.1" && \
|
27 |
curl -sSL https://install.python-poetry.org | python -
|
28 |
-
ENV PATH /
|
29 |
-
COPY --link --chown=1000 ./ /home/user/app
|
30 |
-
RUN useradd -m -u 1000 user
|
31 |
-
WORKDIR /home/user/app
|
32 |
|
33 |
RUN poetry install
|
34 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
35 |
git config --global credential.helper store && \
|
36 |
huggingface-cli login --token $(cat /run/secrets/HF_TOKEN) --add-to-git-credential
|
37 |
RUN poetry run python model_pull.py
|
38 |
-
ENTRYPOINT ["/
|
|
|
14 |
python3.9-dev && \
|
15 |
rm -rf /var/lib/apt/lists/* && \
|
16 |
git lfs install
|
17 |
+
|
18 |
+
COPY --link --chown=1000 ./ /home/user/app
|
19 |
+
RUN useradd -m -u 1000 user
|
20 |
+
WORKDIR /home/user/app
|
21 |
+
USER user
|
22 |
+
|
23 |
RUN curl https://pyenv.run | bash
|
24 |
+
ENV PYENV_ROOT /home/user/.pyenv
|
25 |
ENV PATH ${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}
|
26 |
RUN eval "$(pyenv init -)" && \
|
27 |
eval "$(pyenv virtualenv-init -)" && \
|
|
|
31 |
pip install --no-cache-dir --upgrade pip==22.3.1 setuptools wheel && \
|
32 |
pip install --no-cache-dir datasets "huggingface-hub>=0.12.1" "protobuf<4" "click<8.1" && \
|
33 |
curl -sSL https://install.python-poetry.org | python -
|
34 |
+
ENV PATH /home/user/.local/bin:${PATH}
|
|
|
|
|
|
|
35 |
|
36 |
RUN poetry install
|
37 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
38 |
git config --global credential.helper store && \
|
39 |
huggingface-cli login --token $(cat /run/secrets/HF_TOKEN) --add-to-git-credential
|
40 |
RUN poetry run python model_pull.py
|
41 |
+
ENTRYPOINT ["/home/user/.local/bin/poetry", "run", "python", "app.py", "--host", "0.0.0.0", "--port", "7860"]
|
app.py
CHANGED
@@ -11,8 +11,8 @@ print("starting server ...")
|
|
11 |
assert (
|
12 |
"LlamaTokenizer" in transformers._import_structure["models.llama"]
|
13 |
), "LLaMA is now in HuggingFace's main branch.\nPlease reinstall it: pip uninstall transformers && pip install git+https://github.com/huggingface/transformers.git"
|
14 |
-
from transformers import LlamaForCausalLM
|
15 |
-
from transformers import LlamaTokenizer
|
16 |
|
17 |
BASE_MODEL = "decapoda-research/llama-13b-hf"
|
18 |
LORA_WEIGHTS = "izumi-lab/llama-13b-japanese-lora-v0-1ep"
|
|
|
11 |
assert (
|
12 |
"LlamaTokenizer" in transformers._import_structure["models.llama"]
|
13 |
), "LLaMA is now in HuggingFace's main branch.\nPlease reinstall it: pip uninstall transformers && pip install git+https://github.com/huggingface/transformers.git"
|
14 |
+
from transformers import LlamaForCausalLM # noqa
|
15 |
+
from transformers import LlamaTokenizer # noqa
|
16 |
|
17 |
BASE_MODEL = "decapoda-research/llama-13b-hf"
|
18 |
LORA_WEIGHTS = "izumi-lab/llama-13b-japanese-lora-v0-1ep"
|
model_pull.py
CHANGED
@@ -5,8 +5,8 @@ from peft import PeftModel
|
|
5 |
assert (
|
6 |
"LlamaTokenizer" in transformers._import_structure["models.llama"]
|
7 |
), "LLaMA is now in HuggingFace's main branch.\nPlease reinstall it: pip uninstall transformers && pip install git+https://github.com/huggingface/transformers.git"
|
8 |
-
from transformers import LlamaForCausalLM
|
9 |
-
from transformers import LlamaTokenizer
|
10 |
|
11 |
BASE_MODEL = "decapoda-research/llama-13b-hf"
|
12 |
LORA_WEIGHTS = "izumi-lab/llama-13b-japanese-lora-v0-1ep"
|
|
|
5 |
assert (
|
6 |
"LlamaTokenizer" in transformers._import_structure["models.llama"]
|
7 |
), "LLaMA is now in HuggingFace's main branch.\nPlease reinstall it: pip uninstall transformers && pip install git+https://github.com/huggingface/transformers.git"
|
8 |
+
from transformers import LlamaForCausalLM # noqa
|
9 |
+
from transformers import LlamaTokenizer # noqa
|
10 |
|
11 |
BASE_MODEL = "decapoda-research/llama-13b-hf"
|
12 |
LORA_WEIGHTS = "izumi-lab/llama-13b-japanese-lora-v0-1ep"
|