#!/bin/bash # Fetch the bundled `linear_spec_lora` adapter from the public HF model repo # into `miscs/linear_spec_lora/`. The safetensors weights are gitignored # (too large for github), so this script is needed before the first # `eval.sh --mode linear_spec --lora` run. # # Usage: # bash scripts/fetch_bundled_lora.sh # bash scripts/fetch_bundled_lora.sh --model nvidia/Nemotron-Labs-Diffusion-3B # different size # bash scripts/fetch_bundled_lora.sh --subfolder linear_spec_lora_v2 # different variant set -euo pipefail MODEL="nvidia/Nemotron-Labs-Diffusion-8B" SUBFOLDER="linear_spec_lora" _usage() { cat <&2; _usage >&2; exit 1 ;; esac done SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DEST="$SCRIPT_DIR/../miscs/linear_spec_lora" mkdir -p "$DEST" AUTH_HEADER=() if [[ -n "${HF_TOKEN:-}" ]]; then AUTH_HEADER=(-H "Authorization: Bearer $HF_TOKEN") fi echo "Fetching ${MODEL}/${SUBFOLDER}/ → ${DEST}/ ..." for f in adapter_config.json adapter_model.safetensors; do curl -fSL "${AUTH_HEADER[@]}" \ "https://huggingface.co/${MODEL}/resolve/main/${SUBFOLDER}/${f}" \ -o "$DEST/$f" done ls -lh "$DEST" echo "Done. Use it with: bash eval.sh --mode linear_spec --lora"