Text Generation
PEFT
Safetensors
Transformers
qwen2
lora
sft
trl
unsloth
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use black279/Qwen_LeetCoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use black279/Qwen_LeetCoder with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen2.5-0.5b-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "black279/Qwen_LeetCoder") - Transformers
How to use black279/Qwen_LeetCoder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="black279/Qwen_LeetCoder") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("black279/Qwen_LeetCoder") model = AutoModelForCausalLM.from_pretrained("black279/Qwen_LeetCoder", 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 black279/Qwen_LeetCoder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "black279/Qwen_LeetCoder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "black279/Qwen_LeetCoder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/black279/Qwen_LeetCoder
- SGLang
How to use black279/Qwen_LeetCoder 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 "black279/Qwen_LeetCoder" \ --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": "black279/Qwen_LeetCoder", "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 "black279/Qwen_LeetCoder" \ --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": "black279/Qwen_LeetCoder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use black279/Qwen_LeetCoder with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
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 black279/Qwen_LeetCoder to start chatting
Install Unsloth Studio (Windows)
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 black279/Qwen_LeetCoder to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for black279/Qwen_LeetCoder to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="black279/Qwen_LeetCoder", max_seq_length=2048, ) - Docker Model Runner
How to use black279/Qwen_LeetCoder with Docker Model Runner:
docker model run hf.co/black279/Qwen_LeetCoder
| { | |
| "best_global_step": null, | |
| "best_metric": null, | |
| "best_model_checkpoint": null, | |
| "epoch": 2.0, | |
| "eval_steps": 500, | |
| "global_step": 76, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "epoch": 0.26666666666666666, | |
| "grad_norm": 3.0624091625213623, | |
| "learning_rate": 9e-05, | |
| "loss": 0.8071, | |
| "step": 10 | |
| }, | |
| { | |
| "epoch": 0.5333333333333333, | |
| "grad_norm": 1.9347422122955322, | |
| "learning_rate": 0.00019, | |
| "loss": 0.5748, | |
| "step": 20 | |
| }, | |
| { | |
| "epoch": 0.8, | |
| "grad_norm": 1.6845844984054565, | |
| "learning_rate": 0.00016785714285714288, | |
| "loss": 0.5403, | |
| "step": 30 | |
| }, | |
| { | |
| "epoch": 1.0533333333333332, | |
| "grad_norm": 1.5554804801940918, | |
| "learning_rate": 0.00013214285714285715, | |
| "loss": 0.4359, | |
| "step": 40 | |
| }, | |
| { | |
| "epoch": 1.32, | |
| "grad_norm": 1.5799919366836548, | |
| "learning_rate": 9.642857142857143e-05, | |
| "loss": 0.3043, | |
| "step": 50 | |
| }, | |
| { | |
| "epoch": 1.5866666666666667, | |
| "grad_norm": 1.6146897077560425, | |
| "learning_rate": 6.0714285714285715e-05, | |
| "loss": 0.2456, | |
| "step": 60 | |
| }, | |
| { | |
| "epoch": 1.8533333333333335, | |
| "grad_norm": 1.3090317249298096, | |
| "learning_rate": 2.5e-05, | |
| "loss": 0.2944, | |
| "step": 70 | |
| } | |
| ], | |
| "logging_steps": 10, | |
| "max_steps": 76, | |
| "num_input_tokens_seen": 0, | |
| "num_train_epochs": 2, | |
| "save_steps": 300, | |
| "stateful_callbacks": { | |
| "TrainerControl": { | |
| "args": { | |
| "should_epoch_stop": false, | |
| "should_evaluate": false, | |
| "should_log": false, | |
| "should_save": true, | |
| "should_training_stop": true | |
| }, | |
| "attributes": {} | |
| } | |
| }, | |
| "total_flos": 430849687716864.0, | |
| "train_batch_size": 1, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |