Text Generation
Transformers
Safetensors
Chinese
English
qwen3
qwen
scoring
grading
evaluation
llm-judge
conversational
text-generation-inference
Instructions to use blue-tundra-42/code_and_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use blue-tundra-42/code_and_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="blue-tundra-42/code_and_model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("blue-tundra-42/code_and_model") model = AutoModelForCausalLM.from_pretrained("blue-tundra-42/code_and_model") 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 blue-tundra-42/code_and_model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "blue-tundra-42/code_and_model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "blue-tundra-42/code_and_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/blue-tundra-42/code_and_model
- SGLang
How to use blue-tundra-42/code_and_model 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 "blue-tundra-42/code_and_model" \ --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": "blue-tundra-42/code_and_model", "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 "blue-tundra-42/code_and_model" \ --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": "blue-tundra-42/code_and_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use blue-tundra-42/code_and_model with Docker Model Runner:
docker model run hf.co/blue-tundra-42/code_and_model
| # ---------------- Configuration Area ---------------- | |
| # 1. Inference Model Configuration | |
| MODEL_NAME="Qwen-2.5-Omni-7B" # # requied, registered in ./models | |
| EXP_MARKING="_20251024" # recommended | |
| MODEL_PATH="/path/to/model" # requied | |
| DATASET_NAME="UNO-Bench" | |
| # Option 1: Use a local dataset path | |
| DATASET_LOCAL_DIR="/path/to/dataset" | |
| # Option 2: Use Hugging Face cache path and the program will download this dataset from Hugging Face | |
| HF_CACHE_DIR="~/.cache/huggingface/hub" | |
| # Inference Backend Configuration | |
| # Options: "hf" (local HF loading) or "vllm" (start VLLM service) | |
| INFERENCE_BACKEND="hf" # requied | |
| TARGET_PORT=8000 | |
| TARGET_GPU_IDS="0,1" | |
| TARGET_TP_SIZE=2 | |
| # 2. Scorer Model Configuration (UNO-Scorer) | |
| SCORER_MODEL_PATH="/path/to/scorer" # requied | |
| SCORER_PORT=8001 | |
| SCORER_GPU_IDS="0,1" | |
| SCORER_TP_SIZE=2 | |
| # ------------------------------------------ | |
| set -e | |
| # Global variables to store PIDs for cleanup | |
| TARGET_VLLM_PID="" | |
| SCORER_VLLM_PID="" | |
| # === Cleanup Function === | |
| cleanup() { | |
| echo "--- [Cleanup] Checking for background processes... ---" | |
| if [ -n "$TARGET_VLLM_PID" ]; then | |
| if ps -p $TARGET_VLLM_PID > /dev/null; then | |
| echo "Stopping Target Inference VLLM (PID: $TARGET_VLLM_PID)..." | |
| kill $TARGET_VLLM_PID | |
| wait $TARGET_VLLM_PID 2>/dev/null || true | |
| echo "Target VLLM stopped." | |
| fi | |
| fi | |
| if [ -n "$SCORER_VLLM_PID" ]; then | |
| if ps -p $SCORER_VLLM_PID > /dev/null; then | |
| echo "Stopping Scorer VLLM (PID: $SCORER_VLLM_PID)..." | |
| kill $SCORER_VLLM_PID | |
| wait $SCORER_VLLM_PID 2>/dev/null || true | |
| echo "Scorer VLLM stopped." | |
| fi | |
| fi | |
| } | |
| trap cleanup EXIT SIGINT SIGTERM | |
| # ========================================== | |
| # Stage 1: Inference | |
| # ========================================== | |
| echo ">>> Stage 1: Running Inference ($INFERENCE_BACKEND mode)..." | |
| if [ "$INFERENCE_BACKEND" == "vllm" ]; then | |
| # --- 1.1 Set environment variables specific to Qwen2.5-Omni --- | |
| export VLLM_ALLOW_LONG_MAX_MODEL_LEN=1 | |
| echo "Starting Target Model VLLM Server..." | |
| echo "VIDEO_MAX_PIXELS set to: $VIDEO_MAX_PIXELS" | |
| # --- 1.2 Start VLLM (based on your parameters) --- | |
| CUDA_VISIBLE_DEVICES=$TARGET_GPU_IDS vllm serve "$MODEL_PATH" \ | |
| --port $TARGET_PORT \ | |
| --allowed-local-media-path "$HF_CACHE_DIR" \ | |
| --limit_mm_per_prompt image=8 \ | |
| --max-model-len 131072 \ | |
| --tensor-parallel-size $TARGET_TP_SIZE \ | |
| --trust-remote-code \ | |
| > target_vllm.log 2>&1 & | |
| TARGET_VLLM_PID=$! | |
| echo "Target VLLM PID: $TARGET_VLLM_PID" | |
| # --- 1.3 Run Client for inference --- | |
| # Note: eval.py does not require a GPU, and --dataset_local_dir should preferably point to the media directory or its parent. | |
| CUDA_VISIBLE_DEVICES="" python3 eval.py \ | |
| --mode inference \ | |
| --model_name "$MODEL_NAME" \ | |
| --model_path "$MODEL_PATH" \ | |
| --model_api_url "http://localhost:$TARGET_PORT/v1/chat/completions" \ | |
| --dataset_name "$DATASET_NAME" \ | |
| --hf_cache_dir "$HF_CACHE_DIR" \ | |
| --dataset_local_dir "$DATASET_LOCAL_DIR" \ | |
| --exp_marking "$EXP_MARKING" \ | |
| --batch_size 16 | |
| echo ">>> Inference finished. Stopping Target VLLM to release GPUs..." | |
| # --- 1.4 Force release of resources (critical step) --- | |
| kill $TARGET_VLLM_PID | |
| wait $TARGET_VLLM_PID 2>/dev/null || true | |
| TARGET_VLLM_PID="" | |
| unset VLLM_ALLOW_LONG_MAX_MODEL_LEN | |
| echo ">>> Target GPU resources released." | |
| else | |
| # --- Local HF Mode --- | |
| CUDA_VISIBLE_DEVICES=$TARGET_GPU_IDS python3 eval.py \ | |
| --mode inference \ | |
| --model_name "$MODEL_NAME" \ | |
| --model_path "$MODEL_PATH" \ | |
| --dataset_name "$DATASET_NAME" \ | |
| --exp_marking "$EXP_MARKING" \ | |
| --hf_cache_dir "$HF_CACHE_DIR" \ | |
| --dataset_local_dir "$DATASET_LOCAL_DIR" \ | |
| --batch_size 1 | |
| fi | |
| # ========================================== | |
| # Stage 2: Start Scorer Service (VLLM Scorer) | |
| # ========================================== | |
| echo ">>> Stage 2: Starting Scorer VLLM Server..." | |
| # The Scorer does not need those special Omni environment variables and parameters | |
| CUDA_VISIBLE_DEVICES=$SCORER_GPU_IDS vllm serve "$SCORER_MODEL_PATH" \ | |
| --port $SCORER_PORT \ | |
| --max-model-len 32768 \ | |
| --tensor-parallel-size $SCORER_TP_SIZE \ | |
| --trust-remote-code \ | |
| --gpu-memory-utilization 0.9 \ | |
| > scorer_vllm.log 2>&1 & | |
| SCORER_VLLM_PID=$! | |
| echo "Scorer VLLM PID: $SCORER_VLLM_PID" | |
| # ========================================== | |
| # Stage 3: Evaluation | |
| # ========================================== | |
| echo ">>> Stage 3: Running Evaluation/Scoring..." | |
| CUDA_VISIBLE_DEVICES="" python3 eval.py \ | |
| --mode scoring \ | |
| --model_name "$MODEL_NAME" \ | |
| --exp_marking "$EXP_MARKING" \ | |
| --scorer_api_url "http://localhost:$SCORER_PORT/v1/chat/completions" \ | |
| --dataset_name "$DATASET_NAME" \ | |
| --hf_cache_dir "$HF_CACHE_DIR" \ | |
| --dataset_local_dir "$DATASET_LOCAL_DIR" | |
| echo ">>> Benchmark Workflow Completed Successfully." |