Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- phi-2
|
4 |
+
- conversational-ai
|
5 |
+
- fine-tuned
|
6 |
+
license: mit
|
7 |
+
datasets:
|
8 |
+
- UltraChat
|
9 |
+
- Clocal_data
|
10 |
+
base_model: microsoft/phi-2
|
11 |
+
---
|
12 |
+
|
13 |
+
# phi-2-chat
|
14 |
+
|
15 |
+
**A fine-tuned conversational variant of Microsoft's Phi-2 (2.7B) optimized for dialogue tasks**
|
16 |
+
|
17 |
+
[](LICENSE)
|
18 |
+
[](https://huggingface.co/Irfanuruchi/phi-2-chat)
|
19 |
+
|
20 |
+
## Model Details
|
21 |
+
|
22 |
+
### **Base Model**
|
23 |
+
[microsoft/phi-2](https://huggingface.co/microsoft/phi-2) (2.7B parameters, MIT License)
|
24 |
+
|
25 |
+
### **Training Data**
|
26 |
+
1. **[UltraChat](https://github.com/thunlp/UltraChat)** (CC-BY-NC-4.0):
|
27 |
+
```bibtex
|
28 |
+
@misc{ultrachat,
|
29 |
+
title={UltraChat: A Large-Scale Auto-generated Multi-round Dialogue Dataset},
|
30 |
+
author={Ding et al.},
|
31 |
+
year={2023},
|
32 |
+
howpublished={\url{https://github.com/thunlp/UltraChat}}
|
33 |
+
}
|
34 |
+
```
|
35 |
+
2. Custom synthetic data(Proprietary)
|
36 |
+
|
37 |
+
|
38 |
+
### **Fine-Tuning**
|
39 |
+
- **Objective**: Instruction-following & conversational ability
|
40 |
+
- **Framework**: PyTorch + Transformers
|
41 |
+
- **Context Window**: 2048 tokens
|
42 |
+
|
43 |
+
|
44 |
+
## Usage
|
45 |
+
|
46 |
+
### Quick Inference
|
47 |
+
|
48 |
+
```python
|
49 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
50 |
+
|
51 |
+
model = AutoModelForCausalLM.from_pretrained(
|
52 |
+
"Irfanuruchi/phi-2-chat",
|
53 |
+
trust_remote_code=True,
|
54 |
+
device_map="auto"
|
55 |
+
)
|
56 |
+
tokenizer = AutoTokenizer.from_pretrained("Irfanuruchi/phi-2-chat")
|
57 |
+
|
58 |
+
# Recommended prompt format:
|
59 |
+
input_text = "<|user|>Explain dark matter<|assistant|>"
|
60 |
+
inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
|
61 |
+
outputs = model.generate(**inputs, max_new_tokens=200)
|
62 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
63 |
+
|
64 |
+
```
|
65 |
+
|
66 |
+
|
67 |
+
## Limitations
|
68 |
+
|
69 |
+
- ** Licence Restrictions: License Restrictions: Non-commercial use applies to UltraChat-derived components (CC-BY-NC-4.0)
|
70 |
+
- ** Bias: May reflect biases in base model and training data
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
## License
|
75 |
+
|
76 |
+
- **Core Model**: MIT (inherited from Phi-2)
|
77 |
+
- **UltraChat Components**: CC-BY-NC-4.0 (non-commercial clause applies)
|
78 |
+
- **Custom Data**: Proprietary
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
## Citation
|
83 |
+
|
84 |
+
```bibtex
|
85 |
+
@misc{phi-2-chat,
|
86 |
+
author = {Irfan Uruchi},
|
87 |
+
title = {phi-2-chat: Fine-tuned Phi-2 for conversational AI},
|
88 |
+
year = {2025},
|
89 |
+
publisher = {Hugging Face},
|
90 |
+
howpublished = {\url{https://huggingface.co/Irfanuruchi/phi-2-chat}}
|
91 |
+
}
|
92 |
+
|
93 |
+
@misc{phi2,
|
94 |
+
title={Phi-2: The Surprisingly Capable Small Language Model},
|
95 |
+
author={Microsoft},
|
96 |
+
year={2023},
|
97 |
+
url={https://www.microsoft.com/en-us/research/blog/phi-2-the-surprising-power-of-small-language-models/}
|
98 |
+
}
|
99 |
+
```
|
100 |
+
|
101 |
+
|
102 |
+
## Contact
|
103 |
+
|
104 |
+
For questions or issues, please open a discussion on the Hugging Face Hub.
|
105 |
+
|
106 |
+
Or you can do the same also in GitHub:
|
107 |
+
|
108 |
+
https://github.com/IrfanUruchi/phi-2-chat
|