File size: 600 Bytes
8c67ae7
0d58376
24185c8
0d58376
acc67e5
24185c8
2563224
acc67e5
7919114
acc67e5
 
 
 
 
83b751b
acc67e5
 
7919114
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import streamlit as st
import transformers
from transformers import LLaMATokenizer
import torch
model = "PY007/TinyLlama-1.1B-Chat-v0.1"
tokenizer = transformers.LLaMATokenizer.from_pretrained(model)
pipeline = transformers.pipeline("text-generation",model=model,torch_dtype=torch.bfloat16)

prompt = "What is 653+2343?" 
formatted_prompt = (
    f"### Human: {prompt}### Assistant:"
)


sequences = pipeline(formatted_prompt,do_sample=True,top_k=50,top_p = 0.7,num_return_sequences=1,repetition_penalty=1.1,max_new_tokens=500)
for seq in sequences:
    st.write(f"Result: {seq['generated_text']}")