Text Generation
Transformers
Safetensors
English
phi3
Merge
mergekit
lazymergekit
microsoft/Phi-3-mini-128k-instruct
NexaAIDev/Octopus-v4
conversational
custom_code
text-generation-inference
Instructions to use MrOvkill/Phi-3-Instruct-Bloated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MrOvkill/Phi-3-Instruct-Bloated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MrOvkill/Phi-3-Instruct-Bloated", 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("MrOvkill/Phi-3-Instruct-Bloated", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("MrOvkill/Phi-3-Instruct-Bloated", trust_remote_code=True) 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
- vLLM
How to use MrOvkill/Phi-3-Instruct-Bloated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MrOvkill/Phi-3-Instruct-Bloated" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MrOvkill/Phi-3-Instruct-Bloated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MrOvkill/Phi-3-Instruct-Bloated
- SGLang
How to use MrOvkill/Phi-3-Instruct-Bloated 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 "MrOvkill/Phi-3-Instruct-Bloated" \ --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": "MrOvkill/Phi-3-Instruct-Bloated", "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 "MrOvkill/Phi-3-Instruct-Bloated" \ --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": "MrOvkill/Phi-3-Instruct-Bloated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MrOvkill/Phi-3-Instruct-Bloated with Docker Model Runner:
docker model run hf.co/MrOvkill/Phi-3-Instruct-Bloated
Phi-3-Instruct-Bloated
Phi-3-Instruct-Bloated is a merge of the following models using LazyMergekit:
π§© Configuration
slices:
- sources:
- model: microsoft/Phi-3-mini-128k-instruct
layer_range: [0, 32]
- model: NexaAIDev/Octopus-v4
layer_range: [0, 32]
merge_method: slerp
base_model: microsoft/Phi-3-mini-128k-instruct
parameters:
t:
- filter: self_attn
value: [0, 0.5, 0.3, 0.7, 1]
- filter: mlp
value: [1, 0.5, 0.7, 0.3, 0]
- value: 0.5
dtype: bfloat16
π» Usage
# Installation
!pip install -qU transformers accelerate
# Imports
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Loading
tokenizer = AutoTokenizer.from_pretrained("MrOvkill/Phi-3-Instruct-Bloated")
model = AutoModelForCausalLM.from_pretrained("MrOvkill/Phi-3-Instruct-Bloated")
# Completion function
def infer(prompt, **kwargs):
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(**inputs, **kwargs)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
# Some silliness
infer("<|user|>\nBen is going to the store for some Ice Cream. So is Jerry. They mix up the ice cream at the store. Is the ice cream: (a. Ben's (b. Jerry's (c. Ben and Jerry's <|end|>\n<|assistant|>\nMy answer is (", max_new_tokens=1024)
# A proper test
infer(
"""
<|user|>
Explain what a Mixture of Experts is in less than 100 words.
<|assistant|>
""",
max_new_tokens=1024,
do_sample=False,
temperature=0.0,
top_k=50,
top_p=0.89,
)
- Downloads last month
- 4