masanorihirano
commited on
Commit
•
d6c0cbe
1
Parent(s):
b555022
update
Browse files- Dockerfile +3 -1
- app.py +4 -4
- model_pull.py +3 -1
Dockerfile
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
FROM docker.io/nvidia/cuda:11.7.1-cudnn8-devel-ubuntu20.04
|
2 |
ENV TZ=Asia/Tokyo
|
3 |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
@@ -9,7 +10,8 @@ RUN sed -i 's http://deb.debian.org http://cdn-aws.deb.debian.org g' /etc/apt/so
|
|
9 |
make build-essential libssl-dev zlib1g-dev \
|
10 |
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
|
11 |
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git-lfs \
|
12 |
-
ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx
|
|
|
13 |
rm -rf /var/lib/apt/lists/* && \
|
14 |
git lfs install
|
15 |
RUN curl https://pyenv.run | bash
|
|
|
1 |
+
# syntax=docker/dockerfile:1.4
|
2 |
FROM docker.io/nvidia/cuda:11.7.1-cudnn8-devel-ubuntu20.04
|
3 |
ENV TZ=Asia/Tokyo
|
4 |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
|
10 |
make build-essential libssl-dev zlib1g-dev \
|
11 |
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
|
12 |
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git-lfs \
|
13 |
+
ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx \
|
14 |
+
python3.9-dev && \
|
15 |
rm -rf /var/lib/apt/lists/* && \
|
16 |
git lfs install
|
17 |
RUN curl https://pyenv.run | bash
|
app.py
CHANGED
@@ -2,6 +2,7 @@ from typing import Optional
|
|
2 |
|
3 |
import gradio as gr
|
4 |
import torch
|
|
|
5 |
from peft import PeftModel
|
6 |
from transformers import GenerationConfig
|
7 |
|
@@ -10,7 +11,8 @@ print("starting server ...")
|
|
10 |
assert (
|
11 |
"LlamaTokenizer" in transformers._import_structure["models.llama"]
|
12 |
), "LLaMA is now in HuggingFace's main branch.\nPlease reinstall it: pip uninstall transformers && pip install git+https://github.com/huggingface/transformers.git"
|
13 |
-
from transformers import
|
|
|
14 |
|
15 |
BASE_MODEL = "decapoda-research/llama-13b-hf"
|
16 |
LORA_WEIGHTS = "izumi-lab/llama-13b-japanese-lora-v0-1ep"
|
@@ -35,9 +37,7 @@ if device == "cuda":
|
|
35 |
torch_dtype=torch.float16,
|
36 |
device_map="auto",
|
37 |
)
|
38 |
-
model = PeftModel.from_pretrained(
|
39 |
-
model, LORA_WEIGHTS, torch_dtype=torch.float16
|
40 |
-
)
|
41 |
elif device == "mps":
|
42 |
model = LlamaForCausalLM.from_pretrained(
|
43 |
BASE_MODEL,
|
|
|
2 |
|
3 |
import gradio as gr
|
4 |
import torch
|
5 |
+
import transformers
|
6 |
from peft import PeftModel
|
7 |
from transformers import GenerationConfig
|
8 |
|
|
|
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"
|
|
|
37 |
torch_dtype=torch.float16,
|
38 |
device_map="auto",
|
39 |
)
|
40 |
+
model = PeftModel.from_pretrained(model, LORA_WEIGHTS, torch_dtype=torch.float16)
|
|
|
|
|
41 |
elif device == "mps":
|
42 |
model = LlamaForCausalLM.from_pretrained(
|
43 |
BASE_MODEL,
|
model_pull.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
import torch
|
|
|
2 |
from peft import PeftModel
|
3 |
|
4 |
assert (
|
5 |
"LlamaTokenizer" in transformers._import_structure["models.llama"]
|
6 |
), "LLaMA is now in HuggingFace's main branch.\nPlease reinstall it: pip uninstall transformers && pip install git+https://github.com/huggingface/transformers.git"
|
7 |
-
from transformers import
|
|
|
8 |
|
9 |
BASE_MODEL = "decapoda-research/llama-13b-hf"
|
10 |
LORA_WEIGHTS = "izumi-lab/llama-13b-japanese-lora-v0-1ep"
|
|
|
1 |
import torch
|
2 |
+
import transformers
|
3 |
from peft import PeftModel
|
4 |
|
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"
|