Instructions to use hchen657Naza/PWM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use hchen657Naza/PWM with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("hchen657Naza/PWM", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Download PWM_code/reward_model/scripts/archive/launch_3pointr_train.sh from hchen657Naza/PWM: direct link, hf CLI and curl.
- Browser
- Download file 2.2 kB
-
https://huggingface.co/hchen657Naza/PWM/resolve/main/PWM_code/reward_model/scripts/archive/launch_3pointr_train.sh
- Command line
-
hf download hf://hchen657Naza/PWM/PWM_code/reward_model/scripts/archive/launch_3pointr_train.sh
-
curl -L -o launch_3pointr_train.sh https://huggingface.co/hchen657Naza/PWM/resolve/main/PWM_code/reward_model/scripts/archive/launch_3pointr_train.sh
2.2 kB
| # Launch 3-PoinTr flow pretraining on the Stack-Can dataset we built. | |
| # Splits are computed automatically from #episodes available (90/10 train/val). | |
| set -e | |
| DATA_ROOT="/home/hongyi/PWM/external/3pointr_data" | |
| TASK="stack_can" | |
| N_POINTS=512 # must match build_3pointr_dataset.py --n_points | |
| SPLIT_NAME="${TASK}_flow" | |
| EPOCHS="${EPOCHS:-2000}" | |
| BATCH_SIZE="${BATCH_SIZE:-4}" | |
| cd /home/hongyi/PWM/reward_model/3PoinTr_repo | |
| # Ensure conda is available; use the 'pointr' env. | |
| source /home/hongyi/miniconda3/etc/profile.d/conda.sh | |
| conda activate pointr | |
| # Auto-pick split sizes from #available episodes | |
| TOTAL=$(ls -d "${DATA_ROOT}/no_actions/${TASK}"/[0-9][0-9][0-9][0-9] 2>/dev/null | wc -l) | |
| if [ "$TOTAL" -lt 5 ]; then | |
| echo "ERROR: only ${TOTAL} episodes built; need at least 5"; exit 1 | |
| fi | |
| N_VAL=$((TOTAL / 10)) | |
| [ "$N_VAL" -lt 1 ] && N_VAL=1 | |
| N_TRAIN=$((TOTAL - N_VAL)) | |
| echo "[launch] $TOTAL episodes -> train=$N_TRAIN, val=$N_VAL, test=0" | |
| # Splitter expects [train_actions, val_actions, test_actions, train_flows, val_flows, test_flows] | |
| TASK_SPLITS="{\"${TASK}\": [0, 0, 0, ${N_TRAIN}, ${N_VAL}, 0]}" | |
| python scripts_training/splitter.py \ | |
| --dataset "${DATA_ROOT}/" \ | |
| --task-splits "${TASK_SPLITS}" \ | |
| --out-dir "${DATA_ROOT}/" \ | |
| --name "${SPLIT_NAME}" | |
| SPLIT_FILE="${DATA_ROOT}/${SPLIT_NAME}.json" | |
| echo "[launch] split saved to ${SPLIT_FILE}" | |
| # Pretrain. Architecture roughly matches their default 'glass' run but with | |
| # subsample = N_POINTS so we use all our 512 query points per episode. | |
| mkdir -p /home/hongyi/PWM/reward_model/3pointr_models | |
| python scripts_training/pretrain_flow.py \ | |
| --device cuda:0 \ | |
| --epochs "${EPOCHS}" \ | |
| --batch_size "${BATCH_SIZE}" \ | |
| --lr 1e-4 \ | |
| --arch_dim 256 \ | |
| --arch_depth 2 \ | |
| --arch_heads 4 \ | |
| --arch_query_depth 1 \ | |
| --arch_query_heads 1 \ | |
| --subsample "${N_POINTS}" \ | |
| --dataset "${DATA_ROOT}/" \ | |
| --model_name "${TASK}_flowonly_${N_POINTS}pts" \ | |
| --tasks "${TASK}" \ | |
| --save_dir "/home/hongyi/PWM/reward_model/3pointr_models" \ | |
| --split_file "${SPLIT_FILE}" \ | |
| --flow_data_only \ | |
| --eval_every 50 \ | |
| --save_vis_every 250 \ | |
| --weight_decay 1e-4 \ | |
| --seed 42 \ | |
| --num_workers 4 \ | |
| --cache_data \ | |
| --flow_loss_w 10.0 | |