Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
import os
|
5 |
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig, pipeline
|
6 |
import streamlit as st
|
|
|
7 |
|
8 |
# Define the model repository
|
9 |
# REPO_NAME = 'schuler/experimental-JP47D20'
|
@@ -12,7 +13,6 @@ REPO_NAME = 'schuler/experimental-JP47D21-KPhi-3-micro-4k-instruct'
|
|
12 |
# Configure the Streamlit app
|
13 |
st.set_page_config(page_title="Experimental KPhi3 Model - Currently in Training", page_icon="🤗")
|
14 |
st.title("Experimental KPhi3 Model - Currently in Training")
|
15 |
-
st.markdown(f"*This chat uses the {REPO_NAME} model. Feel free to ask questions such as 'What is biology?' or 'What is the human body?'*")
|
16 |
|
17 |
# Load tokenizer and model
|
18 |
@st.cache_resource(show_spinner="Loading model...")
|
@@ -24,6 +24,9 @@ def load_model(repo_name):
|
|
24 |
|
25 |
tokenizer, generator_conf, model = load_model(REPO_NAME)
|
26 |
|
|
|
|
|
|
|
27 |
try:
|
28 |
generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
29 |
except Exception as e:
|
|
|
4 |
import os
|
5 |
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig, pipeline
|
6 |
import streamlit as st
|
7 |
+
import torch
|
8 |
|
9 |
# Define the model repository
|
10 |
# REPO_NAME = 'schuler/experimental-JP47D20'
|
|
|
13 |
# Configure the Streamlit app
|
14 |
st.set_page_config(page_title="Experimental KPhi3 Model - Currently in Training", page_icon="🤗")
|
15 |
st.title("Experimental KPhi3 Model - Currently in Training")
|
|
|
16 |
|
17 |
# Load tokenizer and model
|
18 |
@st.cache_resource(show_spinner="Loading model...")
|
|
|
24 |
|
25 |
tokenizer, generator_conf, model = load_model(REPO_NAME)
|
26 |
|
27 |
+
st.markdown(f"*This chat uses the {REPO_NAME} model with {model.get_memory_footprint() / 1e6:.2f} MB memory footprint.")
|
28 |
+
st.markdown(f"You may ask questions such as 'What is biology?' or 'What is the human body?'*")
|
29 |
+
|
30 |
try:
|
31 |
generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
32 |
except Exception as e:
|