bvencel commited on
Commit
db46476
·
verified ·
1 Parent(s): 1bd646f

Trying to use Smaug

Browse files
Files changed (1) hide show
  1. app.py +22 -1
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))