Text Generation
Transformers
Safetensors
English
qwen3
long-context
sparse-attention
aha
l2a-style
reproducibility
conversational
text-generation-inference
Instructions to use keepsloading/icml_repro_scratch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use keepsloading/icml_repro_scratch with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="keepsloading/icml_repro_scratch") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("keepsloading/icml_repro_scratch") model = AutoModelForCausalLM.from_pretrained("keepsloading/icml_repro_scratch", 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 keepsloading/icml_repro_scratch with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "keepsloading/icml_repro_scratch" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "keepsloading/icml_repro_scratch", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/keepsloading/icml_repro_scratch
- SGLang
How to use keepsloading/icml_repro_scratch 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 "keepsloading/icml_repro_scratch" \ --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": "keepsloading/icml_repro_scratch", "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 "keepsloading/icml_repro_scratch" \ --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": "keepsloading/icml_repro_scratch", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use keepsloading/icml_repro_scratch with Docker Model Runner:
docker model run hf.co/keepsloading/icml_repro_scratch
| set -euo pipefail | |
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| RECIPE="$(cd "$SCRIPT_DIR/.." && pwd)" | |
| REPO="$(cd "$RECIPE/.." && pwd)" | |
| OUTPUT_ROOT="${OUTPUT_ROOT:-$REPO/outputs}" | |
| EVAL_ROOT="${EVAL_ROOT:-$OUTPUT_ROOT/eval}" | |
| VANILLA_MODEL="${VANILLA_DIR:-$REPO}" | |
| AHA_MODEL="${AHA_MODEL:-$OUTPUT_ROOT/aha/stage2/checkpoint-25}" | |
| L2A_MODEL="${L2A_MODEL:-$OUTPUT_ROOT/l2a_style/stage2/checkpoint-25}" | |
| GPU_LIST="${GPU_LIST:-0}" | |
| THRESHOLDS=(0.45 0.525 0.575 0.65) | |
| BENCHMARKS=(ruler_a ruler_b babilong helmet mrcr) | |
| IFS=',' read -r -a GPUS <<< "$GPU_LIST" | |
| declare -A SLOT_PIDS=() | |
| mkdir -p "$EVAL_ROOT" | |
| for model in "$VANILLA_MODEL" "$L2A_MODEL"; do | |
| [[ -f "$model/config.json" ]] || { echo "Missing model: $model" >&2; exit 2; } | |
| done | |
| # Upload outputs to HF Hub after each config group to survive timeouts | |
| upload_to_hub() { | |
| echo "=== Incremental upload to HF Hub ===" | |
| python -c " | |
| from huggingface_hub import HfApi | |
| import os | |
| api = HfApi() | |
| if os.path.exists('/workspace/outputs'): | |
| api.upload_folder( | |
| folder_path='/workspace/outputs', | |
| repo_id='keepsloading/icml_repro_scratch', | |
| repo_type='model', | |
| path_in_repo='outputs' | |
| ) | |
| print('Incremental upload complete.') | |
| else: | |
| print('No outputs dir yet.') | |
| " || echo "Upload failed (non-fatal), continuing..." | |
| } | |
| launch() { | |
| local gpu="$1" method="$2" model="$3" threshold="$4" benchmark="$5" | |
| EVAL_ROOT="$EVAL_ROOT" RULER_LIMIT=20 BABILONG_LIMIT=50 \ | |
| AHA_GATE_HARD_THRESHOLD="$threshold" \ | |
| bash -x "$SCRIPT_DIR/eval_cell.sh" "$method" "$model" "$gpu" "$benchmark" & | |
| LAST_PID="$!" | |
| } | |
| # Run vanilla baseline | |
| for benchmark in "${BENCHMARKS[@]}"; do | |
| slot=0 | |
| if [[ -n "${SLOT_PIDS[$slot]:-}" ]]; then | |
| wait "${SLOT_PIDS[$slot]}" | |
| fi | |
| launch "${GPUS[$slot]}" "vanilla" "$VANILLA_MODEL" "0.5" "$benchmark" | |
| SLOT_PIDS[$slot]="$LAST_PID" | |
| done | |
| for pid in "${SLOT_PIDS[@]:-}"; do wait "$pid" || true; done | |
| SLOT_PIDS=() | |
| upload_to_hub | |
| # Run each L2A threshold group | |
| for threshold in "${THRESHOLDS[@]}"; do | |
| slug="${threshold/./}" | |
| method="token_t${slug}" | |
| for benchmark in "${BENCHMARKS[@]}"; do | |
| slot=0 | |
| if [[ -n "${SLOT_PIDS[$slot]:-}" ]]; then | |
| wait "${SLOT_PIDS[$slot]}" | |
| fi | |
| launch "${GPUS[$slot]}" "$method" "$L2A_MODEL" "$threshold" "$benchmark" | |
| SLOT_PIDS[$slot]="$LAST_PID" | |
| done | |
| for pid in "${SLOT_PIDS[@]:-}"; do wait "$pid" || true; done | |
| SLOT_PIDS=() | |
| upload_to_hub | |
| done | |
| python "$SCRIPT_DIR/summarize_qwen1p7b_router_granularity_20260714.py" \ | |
| --repo "$REPO" \ | |
| --eval-root "$EVAL_ROOT" \ | |
| --baseline-root "$EVAL_ROOT/vanilla" \ | |
| --input-dir "$RECIPE/data/eval_inputs" \ | |
| --output-dir "$OUTPUT_ROOT/summary" | |