Train
PYTHONPATH=src python -m fps_uda.cli train \
--config configs/training/office31/amazon_to_webcam/vit.yaml \
--out runs/office31/amazon_to_webcam/vit
Training
Training YAML is sectioned and explicit: choose the bank, domains, role-specific views, optimizer, schedule, normalization, losses, and evaluation settings.
CLI
PYTHONPATH=src python -m fps_uda.cli train \
--config configs/training/office31/amazon_to_webcam/vit.yaml \
--out runs/office31/amazon_to_webcam/vit
PYTHONPATH=src python -m fps_uda.cli sweep \
--config configs/training/office31/amazon_to_webcam/vit.yaml \
--alpha-grid 0.6,0.8,1.0 \
--beta-grid 0.4,0.6 \
--out runs/sweeps/office31_aw_vit
Direct CLI
For quick experiments, specify the feature bank, domains, and view roles directly from the command line.
PYTHONPATH=src python -m fps_uda.cli train \
--feature-bank fps_h5cache/banks/office31_vit.h5 \
--source-domain amazon \
--target-domain webcam \
--src-view pad_resize256_input224_center_orig_clean \
--entropy-view pad_resize256_input224_center_orig_clean \
--cr-view1 pad_resize256_input224_center_orig_pool_a \
--cr-view2 pad_resize256_input224_center_orig_pool_b \
--eval-view pad_resize256_input224_center_orig_clean \
--feature-transform none \
--device cuda:0 \
--base-lr 0.000375 \
--iter-num 1000 \
--out runs/debug/cli_only
Configuration
io and views
Select the H5 bank, source/target domains, feature transform,
and role-specific view keys. Multiple views can be
stacked or mean-combined.
optimization and schedule
Configure SGD or AdamW, base_lr, LR schedule,
update count, dynamic alpha/beta, and sample
ratios.
losses
Enable LSE, LCE, LCR, LDelta, sparse density weights, and
pseudo-margin weights. margin_start_step makes the
margin warmup explicit.
io:
feature_bank: fps_h5cache/banks/office_home_vit.h5
source_domain: "Real World"
target_domain: Clipart
feature_transform: none
num_classes: 65
views:
src: {key: pad_resize256_input224_center_orig_clean, combine: stack}
entropy: {key: pad_resize256_input224_center_orig_clean, combine: mean}
cr:
view1: {key: pad_resize256_input224_center_orig_pool_a, combine: stack}
view2: {key: pad_resize256_input224_center_orig_pool_b, combine: stack}
eval: {key: pad_resize256_input224_center_orig_clean, combine: mean}
Autosearch
The search helper selects candidate views, evaluates LR candidates,
searches alpha/beta, lambda_lcr, and
margin settings, then writes sectioned YAML files.
PYTHONPATH=src BACKBONES="resnet vit siglip2" DEVICE=cuda:0 \
bash scripts/search_training_configs.sh
Python API
from fps_uda import FeatureSet, FPSConfig, train_fps
features = FeatureSet(
src_features=src_x,
src_labels=src_y,
entropy_features=tgt_x_eval,
entropy_labels=tgt_y_eval,
cr_features_1=tgt_x_view1,
cr_features_2=tgt_x_view2,
cr_labels=tgt_y_eval,
eval_features=tgt_x_eval,
eval_labels=tgt_y_eval,
)
config = FPSConfig(
num_classes=31,
feature_dim=src_x.shape[1],
device="cuda:0",
base_lr=0.000375,
iter_num=3000,
)
result = train_fps(features, config, output_dir="runs/python_api")