susnato commited on
Commit
e003484
1 Parent(s): 062c0ae

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +32 -1
README.md CHANGED
@@ -2,4 +2,35 @@
2
  license: other
3
  license_name: microsoft-research-license
4
  license_link: LICENSE
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: other
3
  license_name: microsoft-research-license
4
  license_link: LICENSE
5
+ ---
6
+
7
+ **DISCLAIMER**: I don't own the weights to this model, this is a property of Microsoft and taken from their official repository : [microsoft/phi-2](https://huggingface.co/microsoft/phi-2).
8
+ The sole purpose of this repository is to use this model through the `transformers` API or to load and use the model using the HuggingFace `transformers` library.
9
+
10
+
11
+ # Usage
12
+
13
+ First make sure you have the latest version of the `transformers` installed.
14
+
15
+ ```
16
+ pip install -U transformers
17
+ ```
18
+
19
+ Then use the transformers library to load the model from the library itself
20
+
21
+ ```python
22
+ from transformers import AutoModelForCausalLM, AutoTokenizer
23
+
24
+ model = AutoModelForCausalLM.from_pretrained("susnato/phi-2")
25
+ tokenizer = AutoTokenizer.from_pretrained("susnato/phi-2")
26
+
27
+ inputs = tokenizer('''def print_prime(n):
28
+ """
29
+ Print all primes between 1 and n
30
+ """''', return_tensors="pt", return_attention_mask=False)
31
+
32
+ outputs = model.generate(**inputs, max_length=200)
33
+ text = tokenizer.batch_decode(outputs)[0]
34
+ print(text)
35
+
36
+ ```