Text Classification
Transformers
Safetensors
English
modernbert
feature-extraction
decision-model
decision-transformer
ettin
cross-encoder
zero-shot-classification
classification
calibrated-probabilities
routing
multiple-choice
tool-calling
agent-decision
text-embeddings-inference
Instructions to use lCREEl/pick-150m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lCREEl/pick-150m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="lCREEl/pick-150m")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("lCREEl/pick-150m") model = AutoModel.from_pretrained("lCREEl/pick-150m", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add downloadable shell for a separate private recovery training pilot
Browse files- training/run_recovery.sh +113 -0
training/run_recovery.sh
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
: "${HF_TOKEN:?Colab Secrets์ HF_TOKEN์ ํ๊ฒฝ๋ณ์๋ก ์ค์ ํ์ธ์.}"
|
| 4 |
+
export HF_HUB_DISABLE_XET=1
|
| 5 |
+
export HF_HUB_DISABLE_TELEMETRY=1
|
| 6 |
+
export TOKENIZERS_PARALLELISM=false
|
| 7 |
+
export DCT_COMPILE=0
|
| 8 |
+
PICK_HOST_PYTHON="${PICK_HOST_PYTHON:-python3}"
|
| 9 |
+
PICK_TRAIN_ROOT="${PICK_TRAIN_ROOT:-/content/pick-recovery}"
|
| 10 |
+
PICK_TRAIN_NAME="${PICK_TRAIN_NAME:-frozen-head}"
|
| 11 |
+
PICK_TRAIN_MINUTES="${PICK_TRAIN_MINUTES:-150}"
|
| 12 |
+
export PICK_TRAIN_ROOT PICK_TRAIN_NAME PICK_TRAIN_MINUTES
|
| 13 |
+
export PICK_BUNDLE_REPO="lCREEl/pick-v6-recovery"
|
| 14 |
+
export PICK_BUNDLE_REVISION="8c2597fba997b5904eb5e6c22cb40e5e83b06507"
|
| 15 |
+
export PICK_BUNDLE_SHA256="a441bd244998aeda94e0b0aaefd43064cf840f42dfa24a343ccfd9bb25e70ded"
|
| 16 |
+
mkdir -p "$PICK_TRAIN_ROOT"
|
| 17 |
+
if ! "$PICK_HOST_PYTHON" -c 'import huggingface_hub' >/dev/null 2>&1; then
|
| 18 |
+
"$PICK_HOST_PYTHON" -m pip -q install 'huggingface_hub==0.36.2'
|
| 19 |
+
fi
|
| 20 |
+
"$PICK_HOST_PYTHON" - <<'PY'
|
| 21 |
+
import hashlib, os, tarfile
|
| 22 |
+
from pathlib import Path
|
| 23 |
+
from huggingface_hub import hf_hub_download
|
| 24 |
+
p=hf_hub_download(os.environ['PICK_BUNDLE_REPO'],'recovery-bundle.tar.gz',revision=os.environ['PICK_BUNDLE_REVISION'])
|
| 25 |
+
with open(p,'rb') as f:assert hashlib.file_digest(f,'sha256').hexdigest()==os.environ['PICK_BUNDLE_SHA256'],'Bundle hash mismatch'
|
| 26 |
+
with tarfile.open(p) as t:t.extractall(os.environ['PICK_TRAIN_ROOT'],filter='data')
|
| 27 |
+
print('ํ์ต ์ฝ๋ยท๋ฐ์ดํฐ ๋ค์ด๋ก๋ ๋ฐ ํด์ ๊ฒ์ฆ ์๋ฃ.',flush=True)
|
| 28 |
+
PY
|
| 29 |
+
if [[ "${PICK_VERIFY_ONLY:-0}" == "1" ]]; then exit 0; fi
|
| 30 |
+
if ! command -v nvidia-smi >/dev/null 2>&1; then
|
| 31 |
+
echo 'Colab ๋ฐํ์์ ๋ฌด๋ฃ GPU๋ก ์ ํํ ๋ค ๋ค์ ์คํํ์ธ์.' >&2
|
| 32 |
+
exit 1
|
| 33 |
+
fi
|
| 34 |
+
PICK_ENV="$PICK_TRAIN_ROOT/.venv"
|
| 35 |
+
PICK_PYTHON="$PICK_ENV/bin/python3"
|
| 36 |
+
if [[ ! -x "$PICK_PYTHON" || ! -f "$PICK_ENV/pyvenv.cfg" ]]; then
|
| 37 |
+
"$PICK_HOST_PYTHON" -m venv --without-pip "$PICK_ENV"
|
| 38 |
+
fi
|
| 39 |
+
"$PICK_HOST_PYTHON" -m pip --python "$PICK_PYTHON" -q install -r "$PICK_TRAIN_ROOT/requirements.txt"
|
| 40 |
+
"$PICK_PYTHON" - <<'PY'
|
| 41 |
+
import hashlib,json,os,shutil
|
| 42 |
+
from pathlib import Path
|
| 43 |
+
import torch
|
| 44 |
+
from huggingface_hub import HfApi,hf_hub_download,snapshot_download
|
| 45 |
+
assert torch.cuda.is_available(),'CUDA GPU is unavailable'
|
| 46 |
+
root=Path(os.environ['PICK_TRAIN_ROOT']);repo=os.environ['PICK_BUNDLE_REPO'];api=HfApi()
|
| 47 |
+
info=api.repo_info(repo);assert info.private,'Recovery checkpoints must stay private'
|
| 48 |
+
rev=info.sha
|
| 49 |
+
base=snapshot_download('lCREEl/pick-150m',revision='9980b9adcc14331a9b9d44bb936aca0f7deb221d',
|
| 50 |
+
allow_patterns=list(json.loads((root/'base-model-manifest.json').read_text())))
|
| 51 |
+
for name,expected in json.loads((root/'base-model-manifest.json').read_text()).items():
|
| 52 |
+
with (Path(base)/name).open('rb') as f:assert hashlib.file_digest(f,'sha256').hexdigest()==expected,name
|
| 53 |
+
link=root/'base-model'
|
| 54 |
+
if not link.exists():link.symlink_to(Path(base),target_is_directory=True)
|
| 55 |
+
assert link.resolve()==Path(base).resolve(),'Unexpected existing base-model path'
|
| 56 |
+
out=root/'runs'/os.environ['PICK_TRAIN_NAME'];out.mkdir(parents=True,exist_ok=True)
|
| 57 |
+
prefix='runs/'+os.environ['PICK_TRAIN_NAME']+'/'
|
| 58 |
+
files=set(api.list_repo_files(repo,revision=rev))
|
| 59 |
+
if not (out/'latest.pt').exists() and prefix+'latest.pt' in files:
|
| 60 |
+
for name in ['run-config.json','baseline.json','latest.pt']:
|
| 61 |
+
assert prefix+name in files,'Incomplete remote checkpoint'
|
| 62 |
+
source=hf_hub_download(repo,prefix+name,revision=rev)
|
| 63 |
+
shutil.copyfile(source,out/name)
|
| 64 |
+
print('์ด์ HF ํ์ต ์ฒดํฌํฌ์ธํธ๋ฅผ ๋ณต์ํ์ต๋๋ค.',flush=True)
|
| 65 |
+
print('GPU:',torch.cuda.get_device_name(0),'ยท V5 ์๋ณธ ํด์ ๊ฒ์ฆ ์๋ฃ',flush=True)
|
| 66 |
+
PY
|
| 67 |
+
PICK_TRAIN_SECONDS=$((PICK_TRAIN_MINUTES * 60))
|
| 68 |
+
"$PICK_PYTHON" "$PICK_TRAIN_ROOT/scripts/run_pilot.py" \
|
| 69 |
+
--export "$PICK_TRAIN_ROOT/base-model" --device cuda --name "$PICK_TRAIN_NAME" \
|
| 70 |
+
--steps 600 --seconds "$PICK_TRAIN_SECONDS" --grad-accum 8 --lr 3e-6 --head-lr 0 \
|
| 71 |
+
--backup-repo "$PICK_BUNDLE_REPO" --backup-seconds 900
|
| 72 |
+
PICK_NEXT=$("$PICK_PYTHON" - <<'PY'
|
| 73 |
+
import json,os
|
| 74 |
+
from pathlib import Path
|
| 75 |
+
d=json.loads((Path(os.environ['PICK_TRAIN_ROOT'])/'runs'/os.environ['PICK_TRAIN_NAME']/'decision.json').read_text())
|
| 76 |
+
print('resume' if d['step']<600 else 'confirm' if d['decision']=='candidate_only' else 'discard')
|
| 77 |
+
PY
|
| 78 |
+
)
|
| 79 |
+
if [[ "$PICK_NEXT" == "resume" ]]; then
|
| 80 |
+
echo '์ด๋ฒ ์คํ ๊ตฌ๊ฐ์ ๋ง์น๊ณ HF์ ๋ฐฑ์
ํ์ต๋๋ค. ๊ฐ์ ์
์ ๋ค์ ์คํํ๋ฉด ์ด์ด์ง๋๋ค.'
|
| 81 |
+
exit 0
|
| 82 |
+
fi
|
| 83 |
+
if [[ "$PICK_NEXT" == "discard" ]]; then
|
| 84 |
+
echo '600๋จ๊ณ ์๋ฃ. ๊ฐ๋ฐ ๊ฒ์ฆ ๊ธฐ์ค์ ํต๊ณผํ์ง ์์ ํ๋ณด๋ฅผ ์ฑํํ์ง ์์์ต๋๋ค. ๊ฒฐ๊ณผ๋ HF์ ๋ณด๊ดํ์ต๋๋ค.'
|
| 85 |
+
exit 0
|
| 86 |
+
fi
|
| 87 |
+
echo '๊ฐ๋ฐ ๊ฒ์ฆ ํต๊ณผ. ๋ณ๋ ํ์ธ์ฉ ๋ฐ์ดํฐ์์ V5์ ํ๋ณด๋ฅผ ๋น๊ตํฉ๋๋ค.'
|
| 88 |
+
"$PICK_PYTHON" "$PICK_TRAIN_ROOT/scripts/run_pilot.py" --export "$PICK_TRAIN_ROOT/base-model" \
|
| 89 |
+
--device cuda --name "$PICK_TRAIN_NAME-confirm-v5" --eval-only --confirm
|
| 90 |
+
"$PICK_PYTHON" "$PICK_TRAIN_ROOT/scripts/run_pilot.py" --export "$PICK_TRAIN_ROOT/base-model" \
|
| 91 |
+
--checkpoint "$PICK_TRAIN_ROOT/runs/$PICK_TRAIN_NAME/latest.pt" \
|
| 92 |
+
--device cuda --name "$PICK_TRAIN_NAME-confirm-candidate" --eval-only --confirm
|
| 93 |
+
"$PICK_PYTHON" - <<'PY'
|
| 94 |
+
import json,os
|
| 95 |
+
from pathlib import Path
|
| 96 |
+
from huggingface_hub import HfApi
|
| 97 |
+
r=Path(os.environ['PICK_TRAIN_ROOT']);name=os.environ['PICK_TRAIN_NAME'];out=r/'runs'/name
|
| 98 |
+
base=json.loads((r/'runs'/(name+'-confirm-v5')/'confirm.json').read_text())
|
| 99 |
+
cand=json.loads((r/'runs'/(name+'-confirm-candidate')/'confirm.json').read_text())
|
| 100 |
+
delta=cand['proxy_score']-base['proxy_score']
|
| 101 |
+
guard=min(cand['per_task'][n]['score']-base['per_task'][n]['score'] for n in ['banking','clinc','home'])
|
| 102 |
+
summary=dict(status='confirmation_passed_candidate' if delta>=0.5 and guard>=-0.015 else 'discard',
|
| 103 |
+
baseline_proxy=base['proxy_score'],candidate_proxy=cand['proxy_score'],delta=delta,
|
| 104 |
+
worst_anchor_delta=100*guard,public_index=None,
|
| 105 |
+
note='Internal validation only. Submitted V5 unchanged; a new full public evaluation is required.')
|
| 106 |
+
(out/'confirmation-summary.json').write_text(json.dumps(summary,ensure_ascii=False,indent=2)+'\n')
|
| 107 |
+
api=HfApi()
|
| 108 |
+
for folder in [out,r/'runs'/(name+'-confirm-v5'),r/'runs'/(name+'-confirm-candidate')]:
|
| 109 |
+
api.upload_folder(repo_id=os.environ['PICK_BUNDLE_REPO'],folder_path=str(folder),path_in_repo='runs/'+folder.name,
|
| 110 |
+
commit_message='Save separate confirmation results for '+name)
|
| 111 |
+
print(json.dumps(summary,ensure_ascii=False),flush=True)
|
| 112 |
+
PY
|
| 113 |
+
echo "ํ์ตยทํ์ธ ๊ฒ์ฆ ์๋ฃ: https://huggingface.co/lCREEl/pick-v6-recovery/tree/main/runs/$PICK_TRAIN_NAME"
|