Text Generation
Transformers
Safetensors
English
phi
convAI
conversational
custom_code
text-generation-inference
4-bit precision
gptq
Instructions to use RedHatAI/phi-2-super-marlin with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RedHatAI/phi-2-super-marlin with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RedHatAI/phi-2-super-marlin", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RedHatAI/phi-2-super-marlin", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("RedHatAI/phi-2-super-marlin", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RedHatAI/phi-2-super-marlin with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RedHatAI/phi-2-super-marlin" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RedHatAI/phi-2-super-marlin", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RedHatAI/phi-2-super-marlin
- SGLang
How to use RedHatAI/phi-2-super-marlin with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "RedHatAI/phi-2-super-marlin" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RedHatAI/phi-2-super-marlin", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "RedHatAI/phi-2-super-marlin" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RedHatAI/phi-2-super-marlin", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RedHatAI/phi-2-super-marlin with Docker Model Runner:
docker model run hf.co/RedHatAI/phi-2-super-marlin
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
license_link: https://huggingface.co/microsoft/phi-2/resolve/main/LICENSE
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
widget:
|
| 7 |
+
- text: Hello who are you?
|
| 8 |
+
example_title: Identity
|
| 9 |
+
- text: What can you do?
|
| 10 |
+
example_title: Capabilities
|
| 11 |
+
- text: Create a fastapi endpoint to retrieve the weather given a zip code.
|
| 12 |
+
example_title: Coding
|
| 13 |
+
tags:
|
| 14 |
+
- convAI
|
| 15 |
+
- conversational
|
| 16 |
+
pipeline_tag: text-generation
|
| 17 |
+
inference: false
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
<!-- description start -->
|
| 21 |
+
# Phi-2 Super (SFT + cDPO)
|
| 22 |
+

|
| 23 |
+
- **Model creator:** [Anton Bacaj](https://huggingface.co/abacaj)
|
| 24 |
+
- **Original model:** [Phi-2 Super](https://huggingface.co/abacaj/phi-2-super)
|
| 25 |
+
|
| 26 |
+
## Description
|
| 27 |
+
This repo contains 4-bit Marlin format model files for [abacaj's Phi-2 Super](https://huggingface.co/abacaj/phi-2-super)
|
| 28 |
+
|
| 29 |
+
### Phi-2-super (SFT + cDPO)
|
| 30 |
+
|
| 31 |
+
Base Model: [microsoft/phi-2](https://huggingface.co/microsoft/phi-2)
|
| 32 |
+
|
| 33 |
+
### Chat template
|
| 34 |
+
|
| 35 |
+
The model uses the same chat template as found in Mistral instruct models:
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
text = "<|endoftext|>[INST] What is your favourite condiment? [/INST]"
|
| 39 |
+
"Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!<|endoftext|> "
|
| 40 |
+
"[INST] Do you have mayonnaise recipes? [/INST]"
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
### MT-bench / heval
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+

|
| 47 |
+
<!-- description end -->
|