huu-ontocord commited on
Commit
8b6d947
1 Parent(s): ef1d8ad

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +20 -0
README.md CHANGED
@@ -27,4 +27,24 @@ Imagine, if you will, a vast kingdom stretching beyond the horizon, where countl
27
  In this kingdom, information flows like a mighty river,...
28
  ```
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  See the [Phi-3-medium-128k-instruct](https://huggingface.co/microsoft/Phi-3-medium-128k-instruct) model card for more details.
 
27
  In this kingdom, information flows like a mighty river,...
28
  ```
29
 
30
+ In 4-bit
31
+ ```
32
+ from transformers import AutoTokenizer, AutoModelForCausalLM
33
+ import torch
34
+ tokenizer = AutoTokenizer.from_pretrained("ontocord/phi-3-22b", trust_remote_code=True)
35
+ model = AutoModelForCausalLM.from_pretrained("ontocord/phi-3-22b",
36
+ load_in_4bit=True, device_map="auto", trust_remote_code=True, )
37
+ with torch.no_grad():
38
+ print(tokenizer.batch_decode(model.generate(**tokenizer("<|user|>\nHow to explain Internet for a medieval knight?<|end|>\n<|assistant|>\n", return_tensors="pt").to('cuda'), max_new_tokens=128), use_cache=True)[0])
39
+
40
+ ```
41
+
42
+ Will produce:
43
+ ```
44
+ <|user|> How to explain Internet for a medieval knight?<|end|><|assistant|> Ah, noble knight, let me attempt to explain this mystical network known as the Internet, using terms and analogies from your time.
45
+
46
+ Imagine a vast kingdom, stretching far beyond the horizon, where countless villages, towns, and cities are connected by roads, rivers, and paths. Each village is like a castle, filled with people who share knowledge, goods, stories, and news.
47
+
48
+ Now, imagine that instead of messengers, horses, or ships, there exists a magical network of invisible threads connecting all these villages. This network is invisible to the eye, yet it allows messages, scroll
49
+ ```
50
  See the [Phi-3-medium-128k-instruct](https://huggingface.co/microsoft/Phi-3-medium-128k-instruct) model card for more details.