|
|
--- |
|
|
tags: |
|
|
- phi-2 |
|
|
- conversational-ai |
|
|
- fine-tuned |
|
|
license: mit |
|
|
datasets: |
|
|
- UltraChat |
|
|
- Clocal_data |
|
|
base_model: microsoft/phi-2 |
|
|
--- |
|
|
|
|
|
# phi-2-chat |
|
|
|
|
|
**A fine-tuned conversational variant of Microsoft's Phi-2 (2.7B) optimized for dialogue tasks** |
|
|
|
|
|
[](LICENSE) |
|
|
[](https://huggingface.co/Irfanuruchi/phi-2-chat) |
|
|
|
|
|
## Model Details |
|
|
|
|
|
### **Base Model** |
|
|
[microsoft/phi-2](https://huggingface.co/microsoft/phi-2) (2.7B parameters, MIT License) |
|
|
|
|
|
### **Training Data** |
|
|
1. **[UltraChat](https://github.com/thunlp/UltraChat)** (CC-BY-NC-4.0): |
|
|
```bibtex |
|
|
@misc{ultrachat, |
|
|
title={UltraChat: A Large-Scale Auto-generated Multi-round Dialogue Dataset}, |
|
|
author={Ding et al.}, |
|
|
year={2023}, |
|
|
howpublished={\url{https://github.com/thunlp/UltraChat}} |
|
|
} |
|
|
``` |
|
|
2. Custom synthetic data(Proprietary) |
|
|
|
|
|
|
|
|
### **Fine-Tuning** |
|
|
- **Objective**: Instruction-following & conversational ability |
|
|
- **Framework**: PyTorch + Transformers |
|
|
- **Context Window**: 2048 tokens |
|
|
|
|
|
|
|
|
## Usage |
|
|
|
|
|
### Quick Inference |
|
|
|
|
|
```python |
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
|
|
|
model = AutoModelForCausalLM.from_pretrained( |
|
|
"Irfanuruchi/phi-2-chat", |
|
|
trust_remote_code=True, |
|
|
device_map="auto" |
|
|
) |
|
|
tokenizer = AutoTokenizer.from_pretrained("Irfanuruchi/phi-2-chat") |
|
|
|
|
|
# Recommended prompt format: |
|
|
input_text = "<|user|>Explain dark matter<|assistant|>" |
|
|
inputs = tokenizer(input_text, return_tensors="pt").to("cuda") |
|
|
outputs = model.generate(**inputs, max_new_tokens=200) |
|
|
print(tokenizer.decode(outputs[0], skip_special_tokens=True)) |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
## Limitations |
|
|
|
|
|
- ** Licence Restrictions: License Restrictions: Non-commercial use applies to UltraChat-derived components (CC-BY-NC-4.0) |
|
|
- ** Bias: May reflect biases in base model and training data |
|
|
|
|
|
|
|
|
|
|
|
## License |
|
|
|
|
|
- **Core Model**: MIT (inherited from Phi-2) |
|
|
- **UltraChat Components**: CC-BY-NC-4.0 (non-commercial clause applies) |
|
|
- **Custom Data**: Proprietary |
|
|
|
|
|
|
|
|
|
|
|
## Citation |
|
|
|
|
|
```bibtex |
|
|
@misc{phi-2-chat, |
|
|
author = {Irfan Uruchi}, |
|
|
title = {phi-2-chat: Fine-tuned Phi-2 for conversational AI}, |
|
|
year = {2025}, |
|
|
publisher = {Hugging Face}, |
|
|
howpublished = {\url{https://huggingface.co/Irfanuruchi/phi-2-chat}} |
|
|
} |
|
|
|
|
|
@misc{phi2, |
|
|
title={Phi-2: The Surprisingly Capable Small Language Model}, |
|
|
author={Microsoft}, |
|
|
year={2023}, |
|
|
url={https://www.microsoft.com/en-us/research/blog/phi-2-the-surprising-power-of-small-language-models/} |
|
|
} |
|
|
``` |
|
|
|
|
|
|
|
|
## Contact |
|
|
|
|
|
For questions or issues, please open a discussion on the Hugging Face Hub. |
|
|
|
|
|
Or you can do the same also in GitHub: |
|
|
|
|
|
https://github.com/IrfanUruchi/phi-2-chat |