Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zennas score #424

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.base/*
.torch/*

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
24 changes: 24 additions & 0 deletions command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash


job_name=$1
train_gpu=$2
num_node=$3
command=$4
total_process=$((train_gpu*num_node))

mkdir -p log

now=$(date +"%Y%m%d_%H%M%S")

# nohup
GLOG_vmodule=MemcachedClient=-1 \
srun --partition=pat_dev \
--mpi=pmi2 -n$total_process \
--gres=gpu:$train_gpu \
--ntasks-per-node=$train_gpu \
--job-name=$job_name \
--kill-on-bad-exit=1 \
--cpus-per-task=5 \
$command 2>&1|tee -a log/$job_name.log &
# -x "SH-IDC1-10-198-4-[104,106]" \
15 changes: 15 additions & 0 deletions configs/nas/mmcls/zennas/zennas_plainnet_search_8xb128_in1k.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
_base_ = ['./zennas_plainnet_supernet_8xb128_in1k.py']

# model = dict(norm_training=True)

train_cfg = dict(
_delete_=True,
type='mmrazor.ZeroShotLoop',
dataloader=_base_.val_dataloader,
evaluator=_base_.val_evaluator,
search_space='mmrazor/models/architectures/backbones/SearchSpace/search_space_XXBL.py',
plainnet_struct_txt='./work_dirs/1ms/init_plainnet.txt',
max_epochs=480000, # evolution_max_iter
population_size=512,
num_classes=1000,
)
28 changes: 28 additions & 0 deletions configs/nas/mmcls/zennas/zennas_plainnet_supernet_8xb128_in1k.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
_base_ = [
'mmrazor::_base_/settings/imagenet_bs1024_spos.py',
'mmcls::_base_/default_runtime.py',
]

# optim_wrapper=None
model_wrapper_cfg = None
optim_wrapper = dict(_delete_=True, type='OptimWrapper', optimizer=dict(type='SGD', lr=0.01))

nas_backbone = dict(
_scope_='mmrazor',
type='MasterNet',
fix_subnet='./work_dirs/1ms/init_plainnet.txt',
no_create=True,
num_classes=1000)

# model
supernet = dict(
type='ImageClassifier',
data_preprocessor=_base_.preprocess_cfg,
backbone=nas_backbone)

model = dict(
type='mmrazor.ZenNAS',
architecture=supernet
)

# find_unused_parameters = True
3 changes: 2 additions & 1 deletion mmrazor/engine/runner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
from .slimmable_val_loop import SlimmableValLoop
from .subnet_sampler_loop import GreedySamplerTrainLoop
from .subnet_val_loop import SubnetValLoop
from .zero_shot_loop import ZeroShotLoop

__all__ = [
'SingleTeacherDistillValLoop', 'DartsEpochBasedTrainLoop',
'DartsIterBasedTrainLoop', 'SlimmableValLoop', 'EvolutionSearchLoop',
'GreedySamplerTrainLoop', 'SubnetValLoop', 'SelfDistillValLoop',
'ItePruneValLoop'
'ItePruneValLoop', 'ZeroShotLoop'
]
Loading