ysautoml.network.zeroshot

Funtional Modules

  • ysautoml.network.zeroshot.autoformer

  • ysautoml.network.zeroshot.mobilenetv2

ysautoml.network.zeroshot.autoformer

ysautoml.network.zeroshot.autoformer.run_search_zeroshot

ysautoml.network.zeroshot.autoformer.run_search_zeroshot(**kwargs)

Run zero-shot architecture search using AutoFormer on ImageNet.

Parameters

  • param_limits (float): Maximum parameter count limit (e.g., 6, 23, 54 for Tiny/Small/Base).

  • min_param_limits (float): Minimum parameter count limit.

  • cfg (str): Path or name of YAML search space (e.g., 'space-T.yaml').

  • output_dir (str): Directory to save search results.

  • data_path (str, default '/dataset/ILSVRC2012'): Dataset root path.

  • population_num (int, default 10000): Number of architectures to sample.

  • seed (int, default 123): Random seed.

  • gp (bool, default True): Enable Gaussian process metric.

  • relative_position (bool, default True): Enable relative positional embedding.

  • change_qkv (bool, default True): Use QKV reparameterization.

  • dist_eval (bool, default True): Enable distributed evaluation.

Returns

  • None : Logs and search results (including best_arch.yaml and search.log) are saved under output_dir.

Examples


ysautoml.network.zeroshot.autoformer.run_retrain_zeroshot

ysautoml.network.zeroshot.autoformer.run_retrain_zeroshot(**kwargs)

Retrain the best subnet architecture found by AZ-NAS using AutoFormer.

Parameters

  • cfg (str): YAML configuration file path (absolute or relative).

  • output_dir (str): Output directory for retraining results.

  • data_path (str, default '/dataset/ILSVRC2012'): Dataset root path.

  • epochs (int, default 500): Number of training epochs.

  • warmup_epochs (int, default 20): Warm-up epochs.

  • batch_size (int, default 256): Batch size per GPU.

  • model_type (str, default 'AUTOFORMER'): Model type to train.

  • mode (str, default 'retrain'): Training mode.

  • relative_position (bool): Use relative positional embedding.

  • change_qkv (bool): Use QKV reparameterization.

  • gp (bool): Enable Gaussian process module.

  • dist_eval (bool): Enable distributed evaluation.

  • device (str, default '0,1,2,3,4,5,6,7'): Visible CUDA devices.

  • nproc_per_node (int, default 8): Number of distributed processes per node.

  • master_port (int, default 6666): Master port for distributed training.

Returns

  • None : Trained model weights and logs are saved under output_dir.

Examples


ysautoml.network.zeroshot.mobilenetv2

ysautoml.network.zeroshot.mobilenetv2.run_search_zeroshot

ysautoml.network.zeroshot.mobilenetv2.run_search_zeroshot(**kwargs)

Run zero-shot evolution search for MobileNetV2 variants (AZ-NAS).

Parameters

  • gpu (int, default 0): GPU ID to use.

  • seed (int, default 123): Random seed.

  • metric (str, default 'AZ_NAS'): Zero-shot score metric.

  • population_size (int, default 1024): Population size for evolution search.

  • evolution_max_iter (int, default 1e5): Maximum iterations for evolution search.

  • resolution (int, default 224): Input image resolution.

  • budget_flops (float, default 1e9): FLOPs constraint.

  • max_layers (int, default 16): Maximum number of layers.

  • batch_size (int, default 64): Batch size.

  • data_path (str): Path to ImageNet dataset.

  • num_classes (int, default 1000): Number of classes.

  • search_space (str, default 'SearchSpace/search_space_IDW_fixfc.py'): Search space file.

Returns

  • None – Outputs best architecture (best_structure.txt) and FLOPs/params summary in save_dir.

Examples


ysautoml.network.zeroshot.mobilenetv2.run_retrain_zeroshot

ysautoml.network.zeroshot.mobilenetv2.run_retrain_zeroshot(**kwargs)

Retrain the searched MobileNetV2 architecture using AZ-NAS configuration (via Horovod).

Parameters

  • gpu_devices (str, default '0,1,2,3,4,5,6,7'): Visible GPU device IDs.

  • metric (str, default 'AZ_NAS'): Search metric name.

  • population_size (int, default 1024): Population size used in search.

  • evolution_max_iter (int, default 1e5): Number of evolution iterations used in search.

  • seed (int, default 123): Random seed.

  • num_workers (int, default 12): Number of data loader workers.

  • init (str, default 'custom_kaiming'): Weight initialization method.

  • epochs (int, default 150): Number of training epochs.

  • resolution (int, default 224): Input image resolution.

  • batch_size_per_gpu (int, default 64): Batch size per GPU.

  • world_size (int, default 8): Number of distributed workers.

  • data_path (str): Dataset root path.

  • best_structure_path (str, optional): Path to best_structure.txt (absolute or relative to current working directory).

Returns

  • Path – Directory of retraining outputs.

Examples

Last updated