AlanXian commited on
Commit
2003c2f
·
1 Parent(s): 5da8485

update tokenizer

Browse files
Files changed (2) hide show
  1. app.py +9 -0
  2. requirements.txt +1 -1
app.py CHANGED
@@ -50,6 +50,15 @@ h1 {
50
 
51
  # Load the tokenizer and model
52
  tokenizer = AutoTokenizer.from_pretrained("FreedomIntelligence/Apollo-7B")
 
 
 
 
 
 
 
 
 
53
  model = AutoModelForCausalLM.from_pretrained("FreedomIntelligence/Apollo-7B", device_map="auto") # to("cuda:0")
54
  terminators = [
55
  tokenizer.eos_token_id,
 
50
 
51
  # Load the tokenizer and model
52
  tokenizer = AutoTokenizer.from_pretrained("FreedomIntelligence/Apollo-7B")
53
+
54
+ chat = [
55
+ {"role": "user", "content": "Hello, how are you?"},
56
+ {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
57
+ {"role": "user", "content": "I'd like to show off how chat templating works!"},
58
+ ]
59
+
60
+ tokenizer.apply_chat_template(chat, tokenize=False)
61
+
62
  model = AutoModelForCausalLM.from_pretrained("FreedomIntelligence/Apollo-7B", device_map="auto") # to("cuda:0")
63
  terminators = [
64
  tokenizer.eos_token_id,
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
  huggingface_hub==0.25.2
2
- accelerate
3
  transformers
4
  SentencePiece
 
1
  huggingface_hub==0.25.2
2
+ accelerate==4.36
3
  transformers
4
  SentencePiece