jpacifico/French-Alpaca-dataset-Instruct-110K
Viewer • Updated • 110k • 254 • 14
How to use AdrienB134/French-Alpaca-Mistral-7B-v0.3 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="AdrienB134/French-Alpaca-Mistral-7B-v0.3") # Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("AdrienB134/French-Alpaca-Mistral-7B-v0.3")
model = AutoModelForMultimodalLM.from_pretrained("AdrienB134/French-Alpaca-Mistral-7B-v0.3")How to use AdrienB134/French-Alpaca-Mistral-7B-v0.3 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "AdrienB134/French-Alpaca-Mistral-7B-v0.3"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "AdrienB134/French-Alpaca-Mistral-7B-v0.3",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/AdrienB134/French-Alpaca-Mistral-7B-v0.3
How to use AdrienB134/French-Alpaca-Mistral-7B-v0.3 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "AdrienB134/French-Alpaca-Mistral-7B-v0.3" \
--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": "AdrienB134/French-Alpaca-Mistral-7B-v0.3",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "AdrienB134/French-Alpaca-Mistral-7B-v0.3" \
--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": "AdrienB134/French-Alpaca-Mistral-7B-v0.3",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use AdrienB134/French-Alpaca-Mistral-7B-v0.3 with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for AdrienB134/French-Alpaca-Mistral-7B-v0.3 to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for AdrienB134/French-Alpaca-Mistral-7B-v0.3 to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for AdrienB134/French-Alpaca-Mistral-7B-v0.3 to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="AdrienB134/French-Alpaca-Mistral-7B-v0.3",
max_seq_length=2048,
)How to use AdrienB134/French-Alpaca-Mistral-7B-v0.3 with Docker Model Runner:
docker model run hf.co/AdrienB134/French-Alpaca-Mistral-7B-v0.3
This mistral model was trained 2x faster with Unsloth and Huggingface's TRL library.
from unsloth import FastLanguageModel
import torch
max_seq_length = 32_768 # Choose any! We auto support RoPE Scaling internally!
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
load_in_4bit = False # Use 4bit quantization to reduce memory usage. Can be True.
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "AdrienB134/French-Alpaca-Mistral-7B-v0.3",
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
# token = "hf_...", # use one if using gated models like meta-llama/Llama-2-7b-hf
)
alpaca_prompt = """Ci-dessous tu trouveras une instruction qui décrit une tâche, accompagnée d'un contexte qui donne plus d'informations. Ecrit une réponse appropriée à l'instruction.
### Instruction:
{}
### Contexte:
{}
### Response:
{}"""
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
inputs = tokenizer(
[
alpaca_prompt.format(
"Continue la série de fibonacci.", # instruction
"1, 1, 2, 3, 5, 8", # contexte
"", # output - leave this blank for generation!
)
], return_tensors = "pt").to("cuda")
from transformers import TextStreamer
text_streamer = TextStreamer(tokenizer)
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128)