初始化项目,由ModelHub XC社区提供模型
Model: artindnr/tea Source: Original Platform
This commit is contained in:
122
README.md
Normal file
122
README.md
Normal file
@@ -0,0 +1,122 @@
|
||||
---
|
||||
license: mit
|
||||
base_model: microsoft/phi-4
|
||||
tags:
|
||||
- fine-tuned
|
||||
- full-fine-tune
|
||||
- text-generation
|
||||
- chat
|
||||
- question-answering
|
||||
- assistant
|
||||
- pytorch
|
||||
language:
|
||||
- fa
|
||||
- en
|
||||
- multilingual
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
|
||||
# 🍵 Tea
|
||||

|
||||
|
||||
**Tea** is a full fine-tune of [`microsoft/phi-4`](https://huggingface.co/microsoft/phi-4), built for **question answering and long, sustained assistant-style conversations**. It is multilingual, with fine-tuning focused on strong, natural **Farsi (Persian)** conversational ability, while retaining Phi-4's general English and multilingual competence.
|
||||
|
||||
## Model Details
|
||||
|
||||
- **Base model:** [microsoft/phi-4](https://huggingface.co/microsoft/phi-4) (14B parameters)
|
||||
- **Fine-tuning method:** Full fine-tune — all parameters updated, no LoRA/PEFT adapters
|
||||
- **Fine-tuned by:** [artindnr](https://huggingface.co/artindnr)
|
||||
- **License:** MIT
|
||||
- **Languages:** Farsi (primary conversational focus), English, and general multilingual support
|
||||
- **Model type:** Causal decoder-only chat/assistant language model
|
||||
|
||||
## What's New
|
||||
|
||||
tea takes Phi-4's strong base reasoning and language capabilities and tunes them specifically for:
|
||||
|
||||
- **Question answering** — direct, accurate answers grounded in the conversation context
|
||||
- **Long assistant conversations** — maintaining coherence, tone, and context over extended multi-turn sessions rather than short single-shot exchanges
|
||||
- **Farsi fluency** — natural, idiomatic Persian conversation and assistance, alongside solid English and multilingual performance
|
||||
|
||||
Unlike adapter-based fine-tunes, every weight in the model was updated during training, which the author has found gives more consistent behavior for long-conversation use cases than LoRA-based approaches.
|
||||
|
||||
## How to Use
|
||||
|
||||
Tea uses the standard chat template shipped with the base model, so it works out of the box with 🤗 Transformers.
|
||||
|
||||
### Generation
|
||||
|
||||
```python
|
||||
import torch
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
|
||||
MODEL_ID = "artindnr/tea"
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
MODEL_ID,
|
||||
torch_dtype=torch.bfloat16,
|
||||
device_map="auto",
|
||||
)
|
||||
|
||||
USER_PROMPT = "تو کی هستی و اسمت چیه؟"
|
||||
|
||||
messages = [
|
||||
{"role": "user", "content": USER_PROMPT},
|
||||
]
|
||||
|
||||
inputs = tokenizer.apply_chat_template(
|
||||
messages,
|
||||
add_generation_prompt=True,
|
||||
tokenize=True,
|
||||
return_dict=True,
|
||||
return_tensors="pt",
|
||||
).to(model.device)
|
||||
|
||||
outputs = model.generate(
|
||||
**inputs,
|
||||
max_new_tokens=1024,
|
||||
temperature=0.7,
|
||||
do_sample=True,
|
||||
)
|
||||
|
||||
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
|
||||
```
|
||||
|
||||
For multi-turn conversations, simply keep appending `{"role": "user", ...}` / `{"role": "assistant", ...}` turns to the `messages` list before re-applying the chat template — tea is tuned to stay coherent as this history grows.
|
||||
|
||||
## Intended Use
|
||||
|
||||
tea is intended for:
|
||||
|
||||
- Farsi-first conversational assistants that also need to handle English/multilingual input
|
||||
- Question-answering applications requiring direct, grounded answers
|
||||
- Long-running, multi-turn assistant deployments (support bots, tutoring, general-purpose chat) where conversational memory and coherence over many turns matters
|
||||
- Research comparing full fine-tunes vs. adapter-based (LoRA) fine-tunes on the same base model
|
||||
|
||||
## Limitations
|
||||
|
||||
- As a full fine-tune, tea's Farsi-focused training may shift some of Phi-4's original English-centric behaviors; for English-only, general-purpose use cases the base `microsoft/phi-4` model may still be preferable.
|
||||
- tea inherits the general capabilities and limitations of the `phi-4` base model, including the possibility of hallucinated facts, especially over very long contexts.
|
||||
- No formal safety fine-tuning beyond what is inherited from the base model has been applied; use appropriate safeguards in production settings.
|
||||
|
||||
## License
|
||||
|
||||
This model is released under the [MIT License](https://opensource.org/licenses/MIT), consistent with the base `microsoft/phi-4` model.
|
||||
|
||||
## Citation
|
||||
|
||||
If you use tea in your work, please cite:
|
||||
|
||||
```bibtex
|
||||
@misc{tea,
|
||||
title = {tea: A Farsi-Focused, Full Fine-tune of Phi-4 for QA and Long-form Assistance},
|
||||
author = {artindnr},
|
||||
year = {2026},
|
||||
url = {https://huggingface.co/artindnr/tea}
|
||||
}
|
||||
```
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
Built on top of [`microsoft/phi-4`](https://huggingface.co/microsoft/phi-4).
|
||||
Reference in New Issue
Block a user