npvinHnivqn commited on
Commit
41cc240
1 Parent(s): 01d9133

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +8 -9
README.md CHANGED
@@ -39,27 +39,26 @@ List 3 synonyms for the word "tiny"<|endoftext|>
39
  This format is also available through the tokenizer's `apply_chat_template` method:
40
 
41
  ```python
42
- from transformers import AutoModelForCausalLM, AutoTokenizer
 
43
 
44
- tokenizer = AutoTokenizer.from_pretrained('stabilityai/stablelm-zephyr-3b')
45
  model = AutoModelForCausalLM.from_pretrained(
46
- 'stabilityai/stablelm-zephyr-3b',
47
  trust_remote_code=True,
48
  device_map="auto"
49
  )
50
 
51
- prompt = [{'role': 'user', 'content': 'List 3 synonyms for the word "tiny"'}]
52
  inputs = tokenizer.apply_chat_template(
53
  prompt,
54
  add_generation_prompt=True,
55
  return_tensors='pt'
56
  )
57
-
58
- tokens = model.generate(
59
  inputs.to(model.device),
60
- max_new_tokens=1024,
61
- temperature=0.8,
62
- do_sample=True
63
  )
64
 
65
  print(tokenizer.decode(tokens[0], skip_special_tokens=False))
 
39
  This format is also available through the tokenizer's `apply_chat_template` method:
40
 
41
  ```python
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer, AutoModelForSeq2SeqLM
43
+ import torch
44
 
45
+ tokenizer = AutoTokenizer.from_pretrained('models/stablelm_zephyr_3b_with_cross_attn')
46
  model = AutoModelForCausalLM.from_pretrained(
47
+ 'models/stablelm_zephyr_3b_with_cross_attn',
48
  trust_remote_code=True,
49
  device_map="auto"
50
  )
51
 
52
+ prompt = [{'role': 'user', 'content': 'What make a dog bark?'}]
53
  inputs = tokenizer.apply_chat_template(
54
  prompt,
55
  add_generation_prompt=True,
56
  return_tensors='pt'
57
  )
58
+
59
+ tokens = model(
60
  inputs.to(model.device),
61
+ torch.randn((1,19,2560)).to(model.device)
 
 
62
  )
63
 
64
  print(tokenizer.decode(tokens[0], skip_special_tokens=False))