Instructions to use Ja-ck/Mistral-instruct-IPO-Y24-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ja-ck/Mistral-instruct-IPO-Y24-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ja-ck/Mistral-instruct-IPO-Y24-v1")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Ja-ck/Mistral-instruct-IPO-Y24-v1") model = AutoModelForCausalLM.from_pretrained("Ja-ck/Mistral-instruct-IPO-Y24-v1") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Ja-ck/Mistral-instruct-IPO-Y24-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ja-ck/Mistral-instruct-IPO-Y24-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ja-ck/Mistral-instruct-IPO-Y24-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Ja-ck/Mistral-instruct-IPO-Y24-v1
- SGLang
How to use Ja-ck/Mistral-instruct-IPO-Y24-v1 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 "Ja-ck/Mistral-instruct-IPO-Y24-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ja-ck/Mistral-instruct-IPO-Y24-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Ja-ck/Mistral-instruct-IPO-Y24-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ja-ck/Mistral-instruct-IPO-Y24-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Ja-ck/Mistral-instruct-IPO-Y24-v1 with Docker Model Runner:
docker model run hf.co/Ja-ck/Mistral-instruct-IPO-Y24-v1
Prompt Tempalte
It follows Alpaca format.
### μ§λ¬Έ: {instruction}
### λ΅λ³: {output}
Implementation Code
import troch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.fron_pretrained("Ja3ck/Mistral-instruct-IPO-Y24-v1", return_dict=True, torch_dtype=torch.bfloat16, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("Ja3ck/Mistral-instruct-IPO-Y24-v1", use_fast=True)
tokenizer.pad_token = tokenizer.unk_token
tokenizer.pad_token_id = tokenizer.unk_token_id
tokenizer.padding_side = "left"
def gen(x):
x_ = f"### μ§λ¬Έ: {x.strip()} ### λ΅λ³: "
inputs = tokenizer(x_, return_tensor='pt')
input_ids = inputs['input_ids'].cuda()
generation_output = model.generate(
pad_token_id = tokenizer.pad_token_id,
temperature=0.1,
top_p=1,
top_k=50,
num_beams=1,
repetition_penalty=1.13,
do_sample=True,
),
return_dict_in_generate=True,
output_scores=True,
max_new_tokens=1024
)
for seq in generation_output.sequences:
output = tokenizer.decode(seq)
print(output.split("### λ΅λ³: ")[1].strip())
gen("μλ
νμΈμ?")
- Downloads last month
- 5