Chris4K commited on
Commit
2371ba5
·
verified ·
1 Parent(s): 4dc413a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -2,8 +2,13 @@ import streamlit as st
2
  #from transformers import BertModel, BertTokenizer
3
  from transformers import HfAgent, load_tool
4
 
 
 
 
 
 
 
5
 
6
- agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder")
7
  print(agent.run("Is the following `text` (in Spanish) positive or negative?", text="¡Este es un API muy agradable!"))
8
 
9
  # Load tools
 
2
  #from transformers import BertModel, BertTokenizer
3
  from transformers import HfAgent, load_tool
4
 
5
+ checkpoint = "bigcode/starcoder"
6
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
7
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
8
+
9
+ agent = LocalAgent(model, tokenizer)
10
+ agent.run("Draw me a picture of rivers and lakes.")
11
 
 
12
  print(agent.run("Is the following `text` (in Spanish) positive or negative?", text="¡Este es un API muy agradable!"))
13
 
14
  # Load tools