Instructions to use jpacifico/Chocolatine-Admin-3B-SFT-v0.3b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jpacifico/Chocolatine-Admin-3B-SFT-v0.3b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jpacifico/Chocolatine-Admin-3B-SFT-v0.3b", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("jpacifico/Chocolatine-Admin-3B-SFT-v0.3b", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("jpacifico/Chocolatine-Admin-3B-SFT-v0.3b", 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 Settings
- vLLM
How to use jpacifico/Chocolatine-Admin-3B-SFT-v0.3b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jpacifico/Chocolatine-Admin-3B-SFT-v0.3b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jpacifico/Chocolatine-Admin-3B-SFT-v0.3b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/jpacifico/Chocolatine-Admin-3B-SFT-v0.3b
- SGLang
How to use jpacifico/Chocolatine-Admin-3B-SFT-v0.3b 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 "jpacifico/Chocolatine-Admin-3B-SFT-v0.3b" \ --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": "jpacifico/Chocolatine-Admin-3B-SFT-v0.3b", "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 "jpacifico/Chocolatine-Admin-3B-SFT-v0.3b" \ --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": "jpacifico/Chocolatine-Admin-3B-SFT-v0.3b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use jpacifico/Chocolatine-Admin-3B-SFT-v0.3b with Docker Model Runner:
docker model run hf.co/jpacifico/Chocolatine-Admin-3B-SFT-v0.3b
Description model
Chocolatine-Admin-3B version specialized in French administrative language, supervised fine-tuning of jpacifico/Chocolatine-3B-Instruct-DPO-v1.2 based on microsoft/Phi-3.5-mini-instruct
Developed in collaboration with Microsoft.
Data & Training
The dataset based on the official lexicon published by the French DITP, gathers 2362 administrative terms constituting the basis of the simulation of prompt-answer pairs.
The GPT-4o model deployed on Azure OpenAI was used to carry out the building of the dataset in several phases:
- Extraction of the lexicon pages (previously converted into jpg format)
- Reformulation of the definitions to make them more readable and natural to be used by an LLM in order to ensure high quality data.
- Generation of questions from the terms and definitions
- Generation of answers in three successive rounds taking into account the previous generations to ensure variety.
For this 0.3b version, the Fine Tuning (SFT) was performed on 11 epochs with an A100 GPU instance on Azure Machine Learning.
Usage
You can run Chocolatine-Admin using the following code:
import transformers
from transformers import AutoTokenizer
# Format prompt
message = [
{"role": "system", "content": "You are a helpful assistant chatbot."},
{"role": "user", "content": "What is a Large Language Model?"}
]
tokenizer = AutoTokenizer.from_pretrained(new_model)
prompt = tokenizer.apply_chat_template(message, add_generation_prompt=True, tokenize=False)
# Create pipeline
pipeline = transformers.pipeline(
"text-generation",
model=new_model,
tokenizer=tokenizer
)
# Generate text
sequences = pipeline(
prompt,
do_sample=True,
temperature=0.7,
top_p=0.9,
num_return_sequences=1,
max_length=200,
)
print(sequences[0]['generated_text'])
Limitations
The Chocolatine model series is a quick demonstration that a base model can be easily fine-tuned to achieve compelling performance.
It does not have any moderation mechanism.
- Developed by: Jonathan Pacifico at Cellenza, in collaboration with Microsoft (2024)
- License: MIT
- Finetuned from model : jpacifico/Chocolatine-3B-Instruct-DPO-v1.2
- Downloads last month
- 13