Datasets:
Download setup.sh from ruglyphs/RuGlyphs: direct link, hf CLI and curl.
- Browser
- Download file 3.24 kB
-
https://huggingface.co/datasets/ruglyphs/RuGlyphs/resolve/main/setup.sh
- Command line
-
hf download hf://datasets/ruglyphs/RuGlyphs/setup.sh
-
curl -L -o setup.sh https://huggingface.co/datasets/ruglyphs/RuGlyphs/resolve/main/setup.sh
3.24 kB
| # Frameworks for the reproduction: upstream at pinned commits plus our changes. | |
| # | |
| # bash setup.sh # code: clone, apply the patch, install our files | |
| # bash setup.sh envs # also create three venvs from requirements/ | |
| # | |
| # Target: third_party/ next to this script (override with THIRD_PARTY=...). | |
| # | |
| # LLaMA-Factory hiyouga/LlamaFactory @ 2c4f1218 (0.9.5.dev0) | |
| # + third_party/llamafactory/llamafactory-2c4f1218.patch: | |
| # liger_kernel.py: enable Liger for qwen3_5/qwen3_vl (otherwise it is | |
| # silently skipped for Qwen3.5); supervised.py: skip broken examples | |
| # + examples/deepspeed/ds_z1_config.json (ZeRO-1, referenced by the configs) | |
| # lmms-eval EvolvingLMMs-Lab/lmms-eval @ e68e05c0 + our files via | |
| # zero_shot/lmms_eval_files/install.sh: chat/huggingface.py (peft, enable_thinking), | |
| # chat/openai_compatible.py (vLLM client), task ruglyphs | |
| # vLLM 0.19.1 from PyPI (requirements/vllm.txt), unmodified | |
| set -euo pipefail | |
| ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| TP="${THIRD_PARTY:-$ROOT/third_party}" | |
| PYTHON="${PYTHON:-python3.11}" | |
| LF_URL=https://github.com/hiyouga/LlamaFactory.git | |
| LF_COMMIT=2c4f121817bfdef2d39e4f552b294c6639e06485 | |
| LE_URL=https://github.com/EvolvingLMMs-Lab/lmms-eval.git | |
| LE_COMMIT=e68e05c0948f7c87068803f68ea8a0980471bbbf | |
| die() { echo "ERROR: $*" >&2; exit 1; } | |
| # checkout_at <url> <dir> <commit>: clone if missing, then verify HEAD is <commit> | |
| checkout_at() { | |
| local url=$1 dir=$2 commit=$3 | |
| if [ ! -d "$dir/.git" ]; then | |
| git clone --filter=blob:none "$url" "$dir" | |
| git -C "$dir" checkout --quiet --detach "$commit" | |
| fi | |
| [ "$(git -C "$dir" rev-parse HEAD)" = "$commit" ] \ | |
| || die "$dir is not at $commit; remove the directory and rerun" | |
| echo "$dir @ ${commit:0:8}" | |
| } | |
| mkdir -p "$TP" | |
| # --- LLaMA-Factory --- | |
| LF="$TP/LlamaFactory" | |
| checkout_at "$LF_URL" "$LF" "$LF_COMMIT" | |
| PATCH="$ROOT/third_party/llamafactory/llamafactory-2c4f1218.patch" | |
| if git -C "$LF" apply --reverse --check "$PATCH" 2>/dev/null; then | |
| echo " patch already applied" | |
| else | |
| git -C "$LF" apply "$PATCH" && echo " patch applied" | |
| fi | |
| cp "$ROOT/third_party/llamafactory/ds_z1_config.json" "$LF/examples/deepspeed/ds_z1_config.json" | |
| # --- lmms-eval --- | |
| LE="$TP/lmms-eval" | |
| checkout_at "$LE_URL" "$LE" "$LE_COMMIT" | |
| WORKDIR="$LE" YES=1 bash "$ROOT/zero_shot/lmms_eval_files/install.sh" >/dev/null && echo " lmms-eval files installed" | |
| [ "${1:-}" = envs ] || { | |
| echo | |
| echo "Code ready. Environments: bash setup.sh envs (PYTHON=$PYTHON), or manually from requirements/*.txt" | |
| exit 0 | |
| } | |
| # --- environments: three venvs, one per container used for the paper's runs --- | |
| mkenv() { | |
| local name=$1 req=$2; shift 2 | |
| local venv="$ROOT/.venv-$name" | |
| [ -d "$venv" ] || "$PYTHON" -m venv "$venv" | |
| "$venv/bin/pip" install -q --upgrade pip | |
| "$venv/bin/pip" install -r "$ROOT/requirements/$req" | |
| for pkg in "$@"; do "$venv/bin/pip" install --no-deps -e "$pkg"; done | |
| echo "$venv ready" | |
| } | |
| mkenv train train.txt "$LF" # Python 3.11: the flash-attn wheel in train.txt is cp311 | |
| mkenv eval eval.txt "$LE" | |
| mkenv vllm vllm.txt | |