first commit
Browse files- app.py +30 -0
- requirements.txt +9 -0
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import AutoModelForCausalLM, LlamaTokenizer
|
3 |
+
|
4 |
+
|
5 |
+
@st.cache_resource
|
6 |
+
def load():
|
7 |
+
model = AutoModelForCausalLM.from_pretrained(
|
8 |
+
"stabilityai/japanese-stablelm-instruct-alpha-7b",
|
9 |
+
trust_remote_code=True,
|
10 |
+
)
|
11 |
+
tokenizer = LlamaTokenizer.from_pretrained(
|
12 |
+
"novelai/nerdstash-tokenizer-v1",
|
13 |
+
additional_special_tokens=['▁▁'],
|
14 |
+
)
|
15 |
+
return model, tokenizer
|
16 |
+
|
17 |
+
def generate():
|
18 |
+
pass
|
19 |
+
|
20 |
+
|
21 |
+
st.header(":dna: 遺伝カウンセリング対話AI")
|
22 |
+
|
23 |
+
st.sidebar.header("Options")
|
24 |
+
st.session_state["options"]["temperature"] = st.sidebar.slider("temperature", min_value=0.0, max_value=2.0, step=0.1, value=st.session_state["options"]["temperature"])
|
25 |
+
st.session_state["options"]["top_k"] = st.sidebar.slider("top_k", min_value=0, max_value=100, step=1, value=st.session_state["options"]["top_k"])
|
26 |
+
st.session_state["options"]["top_p"] = st.sidebar.slider("top_p", min_value=0.0, max_value=1.0, step=0.1, value=st.session_state["options"]["top_p"])
|
27 |
+
st.session_state["options"]["repetition_penalty"] = st.sidebar.slider("repetition_penalty", min_value=1.0, max_value=2.0, step=0.01, value=st.session_state["options"]["repetition_penalty"])
|
28 |
+
st.session_state["options"]["system_prompt"] = st.sidebar.text_area("System Prompt", value=st.session_state["options"]["system_prompt"])
|
29 |
+
|
30 |
+
model, tokenizer = load()
|
requirements.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit>=1.26.0
|
2 |
+
torch==2.0.0
|
3 |
+
transformers>=4.33.1
|
4 |
+
peft>=0.5.0
|
5 |
+
sentencepiece>=0.1.99
|
6 |
+
einops>=0.6.1
|
7 |
+
bitsandbytes>=0.41.1
|
8 |
+
scipy>=1.11.2
|
9 |
+
accelerate>=0.22.0
|