Instructions to use jungseob/qwen3-4b-instruct-clarity with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jungseob/qwen3-4b-instruct-clarity with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jungseob/qwen3-4b-instruct-clarity") 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("jungseob/qwen3-4b-instruct-clarity") model = AutoModelForCausalLM.from_pretrained("jungseob/qwen3-4b-instruct-clarity", 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jungseob/qwen3-4b-instruct-clarity with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jungseob/qwen3-4b-instruct-clarity" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jungseob/qwen3-4b-instruct-clarity", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/jungseob/qwen3-4b-instruct-clarity
- SGLang
How to use jungseob/qwen3-4b-instruct-clarity 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 "jungseob/qwen3-4b-instruct-clarity" \ --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": "jungseob/qwen3-4b-instruct-clarity", "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 "jungseob/qwen3-4b-instruct-clarity" \ --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": "jungseob/qwen3-4b-instruct-clarity", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use jungseob/qwen3-4b-instruct-clarity with Docker Model Runner:
docker model run hf.co/jungseob/qwen3-4b-instruct-clarity
import json
import torch
from transformers import AutoTokenizer
from vllm import LLM, SamplingParams
# ์ฌ์ฉ์ ์ง๋ฌธ ์์
user_content = "Please write a short story about a cat who becomes a detective. The story should be humorous and no more than 500 words. Set it in a bustling city."
messages = [
{"role": "user", "content": user_content}
]
# ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๊ฒฝ๋ก ์ค์
model_name = "jungseob/qwen3-4b-instruct-clarity"
tokenizer = AutoTokenizer.from_pretrained(model_name)
# vLLM ๋ชจ๋ธ ๋ก๋
num_gpus = torch.cuda.device_count()
llm = LLM(
model=model_name,
tensor_parallel_size=num_gpus,
trust_remote_code=True
)
# ์ฑํ
ํ
ํ๋ฆฟ์ ์ ์ฉํ์ฌ ์ต์ข
ํ๋กฌํํธ ๋ฌธ์์ด ์์ฑ
prompt_string = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
sampling_params = SamplingParams(
max_tokens=400,
temperature=0,
top_p=1.0
)
outputs = llm.generate([prompt_string], sampling_params)
generated_text = outputs[0].outputs[0].text
print(json.loads(generated_text)) # {'ambiguity_terminology': 10, 'necessary_context': 10, 'scope_feasibility': 9, 'self_containment': 10, 'specificity_constraints': 8, 'task_definition': 9}
- Downloads last month
- -