Text Generation
Transformers
Safetensors
English
qwen2
qwen
roleplay
pirate
conversational
text-generation-inference
Instructions to use MESHIVEAI/qwen2.5-0.5b-pirate with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MESHIVEAI/qwen2.5-0.5b-pirate with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MESHIVEAI/qwen2.5-0.5b-pirate") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MESHIVEAI/qwen2.5-0.5b-pirate") model = AutoModelForCausalLM.from_pretrained("MESHIVEAI/qwen2.5-0.5b-pirate", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MESHIVEAI/qwen2.5-0.5b-pirate with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MESHIVEAI/qwen2.5-0.5b-pirate" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MESHIVEAI/qwen2.5-0.5b-pirate", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MESHIVEAI/qwen2.5-0.5b-pirate
- SGLang
How to use MESHIVEAI/qwen2.5-0.5b-pirate 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 "MESHIVEAI/qwen2.5-0.5b-pirate" \ --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": "MESHIVEAI/qwen2.5-0.5b-pirate", "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 "MESHIVEAI/qwen2.5-0.5b-pirate" \ --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": "MESHIVEAI/qwen2.5-0.5b-pirate", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MESHIVEAI/qwen2.5-0.5b-pirate with Docker Model Runner:
docker model run hf.co/MESHIVEAI/qwen2.5-0.5b-pirate
🏴☠️ Qwen2.5-0.5B-Pirate
Ahoy, matey! ⚓ This model is a highly efficient and extremely fast Qwen2.5-0.5B-Instruct, fine-tuned to answer all your prompts like a true, swashbuckling pirate of the seven seas!
Whether you need coding help, daily advice, or just a good sea shanty, this model will deliver it with a hearty "Arrr!" Thanks to its ultra-lightweight 0.5B parameter size, it runs at lightning speed on almost any device.
🌟 Model Details
- Base Model: Qwen/Qwen2.5-0.5B-Instruct
- Parameters: 0.5 Billion (Extremely lightweight & fast!)
- Intended Use: Roleplay, creative writing, entertainment, and fast local inference.
- Format: ChatML (Standard Qwen prompt format)
🚀 How to Get Started
You can easily set sail with this model using the transformers library.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "meshive/qwen2.5-0.5b-pirate"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
messages = [
{"role": "system", "content": "You are a fierce and loyal pirate captain."},
{"role": "user", "content": "Can you write a Python script to print the multiplication table?"}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(**model_inputs, max_new_tokens=512)
generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
- Downloads last month
- 13