johnrachwanpruna commited on
Commit
b049b0d
1 Parent(s): b27a30e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -0
README.md CHANGED
@@ -39,6 +39,28 @@ metrics:
39
 
40
  ## Usage
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  ## Credits & License
44
 
 
39
 
40
  ## Usage
41
 
42
+ ```
43
+ from transformers import AutoTokenizer
44
+ import transformers
45
+ import torch
46
+
47
+ model = "PrunaAI/mattshumer-Hermes-2-Pro-11B-bnb-4bit"
48
+ tokenizer = "mattshumer/Hermes-2-Pro-11B"
49
+ messages = [{"role": "user", "content": "What is a large language model?"}]
50
+
51
+ tokenizer = AutoTokenizer.from_pretrained(tokenizer)
52
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
53
+ pipeline = transformers.pipeline(
54
+ "text-generation",
55
+ model=model,
56
+ device_map="auto",
57
+ cache_dir='/nfs/students/rachwan/delete_me/hermes'
58
+ )
59
+ ```
60
+
61
+ outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
62
+ print(outputs[0]["generated_text"])
63
+
64
 
65
  ## Credits & License
66