mlabonne/alpagasus
Viewer • Updated • 9.23k • 158 • 9
How to use boapps/szurkemarha-mistral with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="boapps/szurkemarha-mistral") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("boapps/szurkemarha-mistral", dtype="auto")How to use boapps/szurkemarha-mistral with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="boapps/szurkemarha-mistral", filename="szurkemarha-mistral-v1-q4.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
How to use boapps/szurkemarha-mistral with llama.cpp:
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf boapps/szurkemarha-mistral # Run inference directly in the terminal: llama-cli -hf boapps/szurkemarha-mistral
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf boapps/szurkemarha-mistral # Run inference directly in the terminal: llama-cli -hf boapps/szurkemarha-mistral
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf boapps/szurkemarha-mistral # Run inference directly in the terminal: ./llama-cli -hf boapps/szurkemarha-mistral
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf boapps/szurkemarha-mistral # Run inference directly in the terminal: ./build/bin/llama-cli -hf boapps/szurkemarha-mistral
docker model run hf.co/boapps/szurkemarha-mistral
How to use boapps/szurkemarha-mistral with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "boapps/szurkemarha-mistral"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "boapps/szurkemarha-mistral",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/boapps/szurkemarha-mistral
How to use boapps/szurkemarha-mistral with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "boapps/szurkemarha-mistral" \
--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": "boapps/szurkemarha-mistral",
"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 "boapps/szurkemarha-mistral" \
--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": "boapps/szurkemarha-mistral",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use boapps/szurkemarha-mistral with Ollama:
ollama run hf.co/boapps/szurkemarha-mistral
How to use boapps/szurkemarha-mistral 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 boapps/szurkemarha-mistral 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 boapps/szurkemarha-mistral to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for boapps/szurkemarha-mistral to start chatting
How to use boapps/szurkemarha-mistral with Docker Model Runner:
docker model run hf.co/boapps/szurkemarha-mistral
How to use boapps/szurkemarha-mistral with Lemonade:
# Download Lemonade from https://lemonade-server.ai/ lemonade pull boapps/szurkemarha-mistral
lemonade run user.szurkemarha-mistral-{{QUANT_TAG}}lemonade list
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf boapps/szurkemarha-mistral# Run inference directly in the terminal:
llama-cli -hf boapps/szurkemarha-mistral# Download pre-built binary from:
# https://github.com/ggerganov/llama.cpp/releases# Start a local OpenAI-compatible server with a web UI:
./llama-server -hf boapps/szurkemarha-mistral# Run inference directly in the terminal:
./llama-cli -hf boapps/szurkemarha-mistralgit clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-server llama-cli# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama-server -hf boapps/szurkemarha-mistral# Run inference directly in the terminal:
./build/bin/llama-cli -hf boapps/szurkemarha-mistraldocker model run hf.co/boapps/szurkemarha-mistralEz az első (teszt) verziója egy magyar nyelvű instrukciókövető modellnek.
Ebben a repoban van egy app.py script, ami egy gradio felületet csinál a kényelmesebb használathoz.
Vagy kódból valahogy így:
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, GenerationConfig
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
BASE_MODEL = "mistralai/Mistral-7B-v0.1"
LORA_WEIGHTS = "boapps/szurkemarha-mistral"
device = "cuda"
try:
if torch.backends.mps.is_available():
device = "mps"
except:
pass
nf4_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.bfloat16
)
model = AutoModelForCausalLM.from_pretrained(BASE_MODEL, quantization_config=nf4_config)
model = PeftModel.from_pretrained(
model, LORA_WEIGHTS, torch_dtype=torch.float16, force_download=True
)
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:
Melyik megyében található az alábbi város?
### Input:
Pécs
### Response:"""
inputs = tokenizer(prompt, return_tensors="pt")
input_ids = inputs["input_ids"].to(device)
generation_config = GenerationConfig(
temperature=0.1,
top_p=0.75,
top_k=40,
num_beams=4,
)
with torch.no_grad():
generation_output = model.generate(
input_ids=input_ids,
generation_config=generation_config,
return_dict_in_generate=True,
output_scores=True,
max_new_tokens=256,
)
s = generation_output.sequences[0]
output = tokenizer.decode(s)
print(output.split("### Response:")[1].strip())
We're not able to determine the quantization variants.
Install from brew
# Start a local OpenAI-compatible server with a web UI: llama-server -hf boapps/szurkemarha-mistral# Run inference directly in the terminal: llama-cli -hf boapps/szurkemarha-mistral