Instructions to use min-samis2/Jonas_Biliunas with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use min-samis2/Jonas_Biliunas with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.3") model = PeftModel.from_pretrained(base_model, "min-samis2/Jonas_Biliunas") - Transformers
How to use min-samis2/Jonas_Biliunas with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="min-samis2/Jonas_Biliunas") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("min-samis2/Jonas_Biliunas", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use min-samis2/Jonas_Biliunas with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "min-samis2/Jonas_Biliunas" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "min-samis2/Jonas_Biliunas", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/min-samis2/Jonas_Biliunas
- SGLang
How to use min-samis2/Jonas_Biliunas 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 "min-samis2/Jonas_Biliunas" \ --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": "min-samis2/Jonas_Biliunas", "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 "min-samis2/Jonas_Biliunas" \ --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": "min-samis2/Jonas_Biliunas", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use min-samis2/Jonas_Biliunas with Docker Model Runner:
docker model run hf.co/min-samis2/Jonas_Biliunas
| from typing import Any, Dict | |
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| from peft import PeftConfig, PeftModel | |
| class EndpointHandler: | |
| def __init__(self, path: str = ""): | |
| cfg = PeftConfig.from_pretrained(path) | |
| base = cfg.base_model_name_or_path | |
| self.tokenizer = AutoTokenizer.from_pretrained(base) | |
| if self.tokenizer.pad_token_id is None: | |
| self.tokenizer.pad_token_id = self.tokenizer.eos_token_id | |
| model = AutoModelForCausalLM.from_pretrained( | |
| base, | |
| torch_dtype=torch.float16, | |
| device_map="auto", | |
| ) | |
| self.model = PeftModel.from_pretrained(model, path) | |
| self.model.eval() | |
| def __call__(self, data: Dict[str, Any]): | |
| inputs = data.get("inputs", "") | |
| params = data.get("parameters", {}) or {} | |
| enc = self.tokenizer(inputs, return_tensors="pt").to(self.model.device) | |
| with torch.no_grad(): | |
| out = self.model.generate( | |
| **enc, | |
| max_new_tokens=int(params.get("max_new_tokens", 256)), | |
| temperature=float(params.get("temperature", 0.7)), | |
| top_p=float(params.get("top_p", 0.9)), | |
| do_sample=bool(params.get("do_sample", True)), | |
| pad_token_id=self.tokenizer.pad_token_id, | |
| ) | |
| text = self.tokenizer.decode( | |
| out[0][enc["input_ids"].shape[1]:], skip_special_tokens=True | |
| ) | |
| return [{"generated_text": text}] | |