RichardErkhov
commited on
Commit
•
c1b8308
1
Parent(s):
e8a0464
uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
phi-2 - bnb 4bits
|
11 |
+
- Model creator: https://huggingface.co/susnato/
|
12 |
+
- Original model: https://huggingface.co/susnato/phi-2/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
license: mit
|
20 |
+
license_name: microsoft-research-license
|
21 |
+
license_link: LICENSE
|
22 |
+
---
|
23 |
+
|
24 |
+
**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).
|
25 |
+
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.
|
26 |
+
|
27 |
+
|
28 |
+
# Usage
|
29 |
+
|
30 |
+
First make sure you have the latest version of the `transformers` installed.
|
31 |
+
|
32 |
+
```
|
33 |
+
pip uninstall -y transformers && pip install git+https://github.com/huggingface/transformers
|
34 |
+
```
|
35 |
+
|
36 |
+
Then use the transformers library to load the model from the library itself
|
37 |
+
|
38 |
+
```python
|
39 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
40 |
+
|
41 |
+
model = AutoModelForCausalLM.from_pretrained("susnato/phi-2")
|
42 |
+
tokenizer = AutoTokenizer.from_pretrained("susnato/phi-2")
|
43 |
+
|
44 |
+
inputs = tokenizer('''def print_prime(n):
|
45 |
+
"""
|
46 |
+
Print all primes between 1 and n
|
47 |
+
"""''', return_tensors="pt", return_attention_mask=False)
|
48 |
+
|
49 |
+
outputs = model.generate(**inputs, max_length=200)
|
50 |
+
text = tokenizer.batch_decode(outputs)[0]
|
51 |
+
print(text)
|
52 |
+
|
53 |
+
```
|
54 |
+
|