Spaces:
Sleeping
Sleeping
Trying to use Smaug
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
@@ -6,4 +8,23 @@ text = ('enter some text:')
|
|
6 |
|
7 |
if text:
|
8 |
out = pipe(text)
|
9 |
-
st.json(out)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
'''
|
3 |
import streamlit as st
|
4 |
from transformers import pipeline
|
5 |
|
|
|
8 |
|
9 |
if text:
|
10 |
out = pipe(text)
|
11 |
+
st.json(out)
|
12 |
+
'''
|
13 |
+
|
14 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
15 |
+
import torch
|
16 |
+
|
17 |
+
model_name = "abacusai/Smaug-72B-v0.1"
|
18 |
+
|
19 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
20 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
21 |
+
|
22 |
+
# Encode some input text
|
23 |
+
input_text = "Who are you?"
|
24 |
+
input_ids = tokenizer.encode(input_text, return_tensors='pt')
|
25 |
+
|
26 |
+
# Generate text using the model
|
27 |
+
output = model.generate(input_ids, max_length=50)
|
28 |
+
|
29 |
+
# Decode and print the output
|
30 |
+
print("Decoded output: " + tokenizer.decode(output[0], skip_special_tokens=True))
|