File size: 425 Bytes
0977766
 
 
5a67153
8e7e7eb
0977766
8e7e7eb
0977766
 
 
 
 
 
 
 
 
8e7e7eb
07817f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
import gradio as gr

model = "tiiuae/falcon-rw-1b"

tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    torch_dtype=torch.bfloat16,
    trust_remote_code=True,
    device_map="auto",
)

gr.Interface.from_pipeline(pipeline).launch()