Instructions to use SamJoshua/injection-guard-fix-recipe with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SamJoshua/injection-guard-fix-recipe with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="SamJoshua/injection-guard-fix-recipe")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SamJoshua/injection-guard-fix-recipe", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download scripts/queue.sh from SamJoshua/injection-guard-fix-recipe: direct link, hf CLI and curl.
- Browser
- Download file 1.43 kB
-
https://huggingface.co/SamJoshua/injection-guard-fix-recipe/resolve/main/scripts/queue.sh
- Command line
-
hf download hf://SamJoshua/injection-guard-fix-recipe/scripts/queue.sh
-
curl -L -o queue.sh https://huggingface.co/SamJoshua/injection-guard-fix-recipe/resolve/main/scripts/queue.sh
1.43 kB
| # Sequential job runner over an editable queue file: scripts/queue.sh [QUEUE_FILE] | |
| # Each line is "RECIPE SEED" (train + screening evaluation) or "!<shell command>" (e.g. a soup or an evaluation-only run). | |
| # Lines can be appended or reordered while it runs; it waits for any training job already running before starting the next. | |
| set -u | |
| trap 'trap - INT TERM; kill 0; exit 130' INT TERM | |
| cd "$(dirname "$0")/.." | |
| q=${1:-work/queue.txt} | |
| mkdir -p work/logs | |
| touch "$q" | |
| while true; do | |
| while pgrep -f "guardtune.train|guardtune.evaluate|guardtune.soup" >/dev/null; do sleep 15; done | |
| line=$(head -n 1 "$q") | |
| if [ -z "$line" ]; then | |
| sed -i '1{/^$/d}' "$q" | |
| sleep 20 | |
| continue | |
| fi | |
| sed -i '1d' "$q" | |
| if [ "${line:0:1}" = "!" ]; then | |
| echo "=== $(date -u +%H:%M:%S) ${line:1}" | tee -a work/logs/screen.txt | |
| bash -c "${line:1}" 2>&1 | grep --line-buffered -v -i -E "unauth|Loading weights|Writing model shards" >> work/logs/commands.log | |
| tail -n 1 work/logs/commands.log | tee -a work/logs/screen.txt | |
| continue | |
| fi | |
| read -r r seed <<< "$line" | |
| seed=${seed:-0} | |
| echo "=== $(date -u +%H:%M:%S) $r s$seed" | tee -a work/logs/screen.txt | |
| python -m guardtune.train --recipe "$r" --seed "$seed" 2>&1 \ | |
| | grep --line-buffered -v -i -E "unauth|Loading weights|Writing model shards" > "work/logs/${r}_s${seed}.log" | |
| tail -n 1 "work/logs/${r}_s${seed}.log" | tee -a work/logs/screen.txt | |
| done | |