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)# pip install -U transformers accelerate # 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=256) 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
Upload folder using huggingface_hub
Browse files- recipe/scripts/eval_sweep.sh +41 -18
recipe/scripts/eval_sweep.sh
CHANGED
|
@@ -20,16 +20,25 @@ for model in "$VANILLA_MODEL" "$L2A_MODEL"; do
|
|
| 20 |
[[ -f "$model/config.json" ]] || { echo "Missing model: $model" >&2; exit 2; }
|
| 21 |
done
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
launch() {
|
| 35 |
local gpu="$1" method="$2" model="$3" threshold="$4" benchmark="$5"
|
|
@@ -39,21 +48,35 @@ launch() {
|
|
| 39 |
LAST_PID="$!"
|
| 40 |
}
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
|
|
|
| 44 |
if [[ -n "${SLOT_PIDS[$slot]:-}" ]]; then
|
| 45 |
wait "${SLOT_PIDS[$slot]}"
|
| 46 |
fi
|
| 47 |
-
|
| 48 |
-
launch "${GPUS[$slot]}" "$method" "$model" "$threshold" "$benchmark"
|
| 49 |
SLOT_PIDS[$slot]="$LAST_PID"
|
| 50 |
done
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
-
for
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
done
|
| 56 |
-
[[ "$status" == 0 ]] || exit "$status"
|
| 57 |
|
| 58 |
python "$SCRIPT_DIR/summarize_qwen1p7b_router_granularity_20260714.py" \
|
| 59 |
--repo "$REPO" \
|
|
|
|
| 20 |
[[ -f "$model/config.json" ]] || { echo "Missing model: $model" >&2; exit 2; }
|
| 21 |
done
|
| 22 |
|
| 23 |
+
# Upload outputs to HF Hub after each config group to survive timeouts
|
| 24 |
+
upload_to_hub() {
|
| 25 |
+
echo "=== Incremental upload to HF Hub ==="
|
| 26 |
+
python -c "
|
| 27 |
+
from huggingface_hub import HfApi
|
| 28 |
+
import os
|
| 29 |
+
api = HfApi()
|
| 30 |
+
if os.path.exists('/workspace/outputs'):
|
| 31 |
+
api.upload_folder(
|
| 32 |
+
folder_path='/workspace/outputs',
|
| 33 |
+
repo_id='keepsloading/icml_repro_scratch',
|
| 34 |
+
repo_type='model',
|
| 35 |
+
path_in_repo='outputs'
|
| 36 |
+
)
|
| 37 |
+
print('Incremental upload complete.')
|
| 38 |
+
else:
|
| 39 |
+
print('No outputs dir yet.')
|
| 40 |
+
" || echo "Upload failed (non-fatal), continuing..."
|
| 41 |
+
}
|
| 42 |
|
| 43 |
launch() {
|
| 44 |
local gpu="$1" method="$2" model="$3" threshold="$4" benchmark="$5"
|
|
|
|
| 48 |
LAST_PID="$!"
|
| 49 |
}
|
| 50 |
|
| 51 |
+
# Run vanilla baseline
|
| 52 |
+
for benchmark in "${BENCHMARKS[@]}"; do
|
| 53 |
+
slot=0
|
| 54 |
if [[ -n "${SLOT_PIDS[$slot]:-}" ]]; then
|
| 55 |
wait "${SLOT_PIDS[$slot]}"
|
| 56 |
fi
|
| 57 |
+
launch "${GPUS[$slot]}" "vanilla" "$VANILLA_MODEL" "0.5" "$benchmark"
|
|
|
|
| 58 |
SLOT_PIDS[$slot]="$LAST_PID"
|
| 59 |
done
|
| 60 |
+
for pid in "${SLOT_PIDS[@]:-}"; do wait "$pid" || true; done
|
| 61 |
+
SLOT_PIDS=()
|
| 62 |
+
upload_to_hub
|
| 63 |
|
| 64 |
+
# Run each L2A threshold group
|
| 65 |
+
for threshold in "${THRESHOLDS[@]}"; do
|
| 66 |
+
slug="${threshold/./}"
|
| 67 |
+
method="token_t${slug}"
|
| 68 |
+
for benchmark in "${BENCHMARKS[@]}"; do
|
| 69 |
+
slot=0
|
| 70 |
+
if [[ -n "${SLOT_PIDS[$slot]:-}" ]]; then
|
| 71 |
+
wait "${SLOT_PIDS[$slot]}"
|
| 72 |
+
fi
|
| 73 |
+
launch "${GPUS[$slot]}" "$method" "$L2A_MODEL" "$threshold" "$benchmark"
|
| 74 |
+
SLOT_PIDS[$slot]="$LAST_PID"
|
| 75 |
+
done
|
| 76 |
+
for pid in "${SLOT_PIDS[@]:-}"; do wait "$pid" || true; done
|
| 77 |
+
SLOT_PIDS=()
|
| 78 |
+
upload_to_hub
|
| 79 |
done
|
|
|
|
| 80 |
|
| 81 |
python "$SCRIPT_DIR/summarize_qwen1p7b_router_granularity_20260714.py" \
|
| 82 |
--repo "$REPO" \
|