MarulAI/Marul-SFT-TR
Viewer • Updated • 99.8k • 515 • 1
How to use Gokturk97/AstrumN1Mini-v2 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Gokturk97/AstrumN1Mini-v2")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Gokturk97/AstrumN1Mini-v2")
model = AutoModelForCausalLM.from_pretrained("Gokturk97/AstrumN1Mini-v2", device_map="auto")
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=256)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use Gokturk97/AstrumN1Mini-v2 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Gokturk97/AstrumN1Mini-v2"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Gokturk97/AstrumN1Mini-v2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Gokturk97/AstrumN1Mini-v2
How to use Gokturk97/AstrumN1Mini-v2 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Gokturk97/AstrumN1Mini-v2" \
--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": "Gokturk97/AstrumN1Mini-v2",
"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 "Gokturk97/AstrumN1Mini-v2" \
--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": "Gokturk97/AstrumN1Mini-v2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Gokturk97/AstrumN1Mini-v2 with Docker Model Runner:
docker model run hf.co/Gokturk97/AstrumN1Mini-v2
Göktürk Bağbaşı tarafından geliştirilen Astrum model ailesinin küçük üyesi. Qwen tabanlı, ~0,5 milyar parametreli Türkçe sohbet modeli.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "Gokturk97/AstrumN1Mini-v2"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.float16, device_map="auto")
SYSTEM = "Sen AstrumN1Mini-v2'sin. Göktürk Bağbaşı tarafından geliştirilen Astrum ailesinden, Qwen tabanlı 0,5 milyar parametreli bir Türkçe yapay zeka modelisin. Samimi konuşursun."
q = "Selam, naber?"
p = f"<|im_start|>system\n{SYSTEM}<|im_end|>\n<|im_start|>user\n{q}<|im_end|>\n<|im_start|>assistant\n"
ids = tok(p, return_tensors="pt", add_special_tokens=False).input_ids.to(model.device)
out = model.generate(ids, max_new_tokens=200, do_sample=True, temperature=0.2, top_p=0.95,
eos_token_id=tok.convert_tokens_to_ids("<|im_end|>"))
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))