sandeepsundaram
commited on
Commit
•
ef7f603
1
Parent(s):
ad5d683
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
datasets:
|
4 |
+
- HuggingFaceH4/ultrachat_200k
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
---
|
8 |
+
|
9 |
+
## Model Summary
|
10 |
+
|
11 |
+
phi2-ultrachat-qlora is a Transformer fine tuned using the ultrachat dataset.
|
12 |
+
|
13 |
+
Our model hasn't been fine-tuned through reinforcement learning from human feedback. The intention behind crafting this open-source model is to provide the research community with a non-restricted small model to explore vital safety challenges, such as reducing toxicity, understanding societal biases, enhancing controllability, and more.
|
14 |
+
|
15 |
+
|
16 |
+
### Inference Code:
|
17 |
+
|
18 |
+
```python
|
19 |
+
import warnings
|
20 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
21 |
+
|
22 |
+
path= f"sandeepsundaram/phi2-ultrachat-qlora"
|
23 |
+
tokenizer = AutoTokenizer.from_pretrained(path)
|
24 |
+
tokenizer.eos_token_id = model.config.eos_token_id
|
25 |
+
tokenizer.pad_token = tokenizer.eos_token
|
26 |
+
tokenizer.add_special_tokens({'pad_token': '[PAD]'})
|
27 |
+
|
28 |
+
warnings.filterwarnings('ignore') # Ignore all warnings
|
29 |
+
#inputs = tokenizer('Question: why human are cute then human? write in the form of poem. \n Output: ', return_tensors="pt", return_attention_mask=False).to('cuda')
|
30 |
+
inputs = tokenizer('''write code for fibonaci series in python.''', return_tensors="pt", return_attention_mask=False).to('cuda')
|
31 |
+
generation_params = {
|
32 |
+
'max_length': 512,
|
33 |
+
'do_sample': True,
|
34 |
+
'temperature': .5,
|
35 |
+
'top_p': 0.9,
|
36 |
+
'top_k': 50
|
37 |
+
}
|
38 |
+
|
39 |
+
outputs = model.generate(**inputs, **generation_params)
|
40 |
+
decoded_outputs = tokenizer.batch_decode(outputs)
|
41 |
+
|
42 |
+
for text in decoded_outputs:
|
43 |
+
text = text.replace('\\n', '\n')
|
44 |
+
print(text)
|
45 |
+
print("\n\n")
|
46 |
+
```
|