Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,12 @@
|
|
1 |
import streamlit as st
|
2 |
-
from transformers import
|
3 |
|
4 |
-
|
5 |
-
# Load the model in full precision
|
6 |
model = AutoModelForCausalLM.from_pretrained("PAIXAI/Astrid-1B").to(dtype=torch.float32)
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
generate_text = pipeline(
|
11 |
-
model="PAIXAI/Astrid-1B",
|
12 |
-
torch_dtype="auto",
|
13 |
-
trust_remote_code=True,
|
14 |
-
use_fast=True
|
15 |
-
)
|
16 |
|
17 |
# Streamlit UI
|
18 |
st.title("Astrid-1B Chatbot")
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextGenerationPipeline
|
3 |
|
4 |
+
# Load the model and tokenizer in full precision
|
|
|
5 |
model = AutoModelForCausalLM.from_pretrained("PAIXAI/Astrid-1B").to(dtype=torch.float32)
|
6 |
+
tokenizer = AutoTokenizer.from_pretrained("PAIXAI/Astrid-1B")
|
7 |
|
8 |
+
# Initialize the pipeline with the model and tokenizer
|
9 |
+
generate_text = TextGenerationPipeline(model=model, tokenizer=tokenizer, device=0 if torch.cuda.is_available() else -1)
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# Streamlit UI
|
12 |
st.title("Astrid-1B Chatbot")
|