|
--- |
|
language: |
|
- en |
|
license: apache-2.0 |
|
library_name: peft |
|
tags: |
|
- trl |
|
- unsloth |
|
- nlp |
|
- code |
|
base_model: unsloth/Phi-3-mini-4k-instruct-bnb-4bit |
|
datasets: |
|
- reciperesearch/dolphin-sft-v0.1-preference |
|
pipeline_tag: text-generation |
|
widget: |
|
- messages: |
|
- role: user |
|
content: Can you provide ways to eat combinations of bananas and dragonfruits? |
|
--- |
|
|
|
## Model Summary |
|
|
|
The Phi-3-Mini-4K-Instruct is a 3.8B parameters, lightweight, state-of-the-art open model trained with the Phi-3 datasets that includes both synthetic data and the filtered publicly available websites data with a focus on high-quality and reasoning dense properties. |
|
|
|
### Chat Format |
|
|
|
Given the nature of the training data, the Phi-3 Mini-4K-Instruct model is best suited for prompts using the chat format as follows. |
|
```python |
|
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request. |
|
|
|
### Instruction: |
|
{} |
|
|
|
### Input: |
|
{} |
|
|
|
### Response: |
|
{}""" |
|
``` |
|
|
|
### Sample inference code |
|
|
|
This code snippets show how to get quickly started with running the model on a GPU: |
|
```python |
|
pip install peft transformers bitsandbytes accelerate |
|
``` |
|
```python |
|
from transformers import AutoModelForCausalLM |
|
from transformers import AutoTokenizer |
|
model = AutoModelForCausalLM.from_pretrained( |
|
"rishiraj/Phi-3-mini-4k-ORPO", |
|
load_in_4bit = True, |
|
) |
|
tokenizer = AutoTokenizer.from_pretrained("rishiraj/Phi-3-mini-4k-ORPO") |
|
|
|
# alpaca_prompt = You MUST copy from above! |
|
|
|
inputs = tokenizer( |
|
[ |
|
alpaca_prompt.format( |
|
"What is a famous tall tower in Paris?", # instruction |
|
"", # input |
|
"", # output - leave this blank for generation! |
|
) |
|
], return_tensors = "pt").to("cuda") |
|
|
|
outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True) |
|
tokenizer.batch_decode(outputs) |
|
``` |