Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
inference: false
|
| 7 |
+
tags:
|
| 8 |
+
- transformers
|
| 9 |
+
- gguf
|
| 10 |
+
- imatrix
|
| 11 |
+
- phi-4
|
| 12 |
+
---
|
| 13 |
+
Quantizations of https://huggingface.co/microsoft/phi-4
|
| 14 |
+
|
| 15 |
+
### Inference Clients/UIs
|
| 16 |
+
* [llama.cpp](https://github.com/ggerganov/llama.cpp)
|
| 17 |
+
* [KoboldCPP](https://github.com/LostRuins/koboldcpp)
|
| 18 |
+
* [ollama](https://github.com/ollama/ollama)
|
| 19 |
+
* [jan](https://github.com/janhq/jan)
|
| 20 |
+
* [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
| 21 |
+
* [GPT4All](https://github.com/nomic-ai/gpt4all)
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
# From original readme
|
| 25 |
+
|
| 26 |
+
| | |
|
| 27 |
+
|-------------------------|-------------------------------------------------------------------------------|
|
| 28 |
+
| **Developers** | Microsoft Research |
|
| 29 |
+
| **Description** | `phi-4` is a state-of-the-art open model built upon a blend of synthetic datasets, data from filtered public domain websites, and acquired academic books and Q&A datasets. The goal of this approach was to ensure that small capable models were trained with data focused on high quality and advanced reasoning.<br><br>`phi-4` underwent a rigorous enhancement and alignment process, incorporating both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures |
|
| 30 |
+
| **Architecture** | 14B parameters, dense decoder-only Transformer model |
|
| 31 |
+
| **Inputs** | Text, best suited for prompts in the chat format |
|
| 32 |
+
| **Context length** | 16K tokens |
|
| 33 |
+
| **GPUs** | 1920 H100-80G |
|
| 34 |
+
| **Training time** | 21 days |
|
| 35 |
+
| **Training data** | 9.8T tokens |
|
| 36 |
+
| **Outputs** | Generated text in response to input |
|
| 37 |
+
| **Dates** | October 2024 – November 2024 |
|
| 38 |
+
| **Status** | Static model trained on an offline dataset with cutoff dates of June 2024 and earlier for publicly available data |
|
| 39 |
+
| **Release date** | December 12, 2024 |
|
| 40 |
+
| **License** | MIT |
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
### Input Formats
|
| 44 |
+
|
| 45 |
+
Given the nature of the training data, `phi-4` is best suited for prompts using the chat format as follows:
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
<|im_start|>system<|im_sep|>
|
| 49 |
+
You are a medieval knight and must provide explanations to modern people.<|im_end|>
|
| 50 |
+
<|im_start|>user<|im_sep|>
|
| 51 |
+
How should I explain the Internet?<|im_end|>
|
| 52 |
+
<|im_start|>assistant<|im_sep|>
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
### With `transformers`
|
| 56 |
+
|
| 57 |
+
```python
|
| 58 |
+
import transformers
|
| 59 |
+
|
| 60 |
+
pipeline = transformers.pipeline(
|
| 61 |
+
"text-generation",
|
| 62 |
+
model="microsoft/phi-4",
|
| 63 |
+
model_kwargs={"torch_dtype": "auto"},
|
| 64 |
+
device_map="auto",
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
messages = [
|
| 68 |
+
{"role": "system", "content": "You are a medieval knight and must provide explanations to modern people."},
|
| 69 |
+
{"role": "user", "content": "How should I explain the Internet?"},
|
| 70 |
+
]
|
| 71 |
+
|
| 72 |
+
outputs = pipeline(messages, max_new_tokens=128)
|
| 73 |
+
print(outputs[0]["generated_text"][-1])
|
| 74 |
+
```
|