TIGER-Lab/MathInstruct
Viewer • Updated • 262k • 8k • 303
How to use suayptalha/Komodo-LoRA with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="suayptalha/Komodo-LoRA")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("suayptalha/Komodo-LoRA", dtype="auto")How to use suayptalha/Komodo-LoRA with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "suayptalha/Komodo-LoRA"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "suayptalha/Komodo-LoRA",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/suayptalha/Komodo-LoRA
How to use suayptalha/Komodo-LoRA with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "suayptalha/Komodo-LoRA" \
--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": "suayptalha/Komodo-LoRA",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "suayptalha/Komodo-LoRA" \
--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": "suayptalha/Komodo-LoRA",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use suayptalha/Komodo-LoRA 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 suayptalha/Komodo-LoRA 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 suayptalha/Komodo-LoRA to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for suayptalha/Komodo-LoRA to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="suayptalha/Komodo-LoRA",
max_seq_length=2048,
)How to use suayptalha/Komodo-LoRA with Docker Model Runner:
docker model run hf.co/suayptalha/Komodo-LoRA
These are the LoRA adapters for model Komodo-7B-Instruct. https://huggingface.co/suayptalha/Komodo-7B-Instruct
Suggested Usage:
model_name = "Qwen/Qwen2.5-7b-Instruct"
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16
)
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto",
torch_dtype=torch.float16,
quantization_config=bnb_config
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
adapter_path = "suayptalha/Komodo-LoRA"
model = PeftModel.from_pretrained(model, adapter_path)
example_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:
{}
### Input:
{}
### Response:
{}"""
inputs = tokenizer(
[
example_prompt.format(
"", #Your question here
"", #Given input here
"", #Output (for training)
)
], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 512, use_cache = True)
tokenizer.batch_decode(outputs)