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

Simpler auto log hparams #1855

Merged
merged 10 commits into from
Jan 6, 2023
Merged

Simpler auto log hparams #1855

merged 10 commits into from
Jan 6, 2023

Conversation

eracah
Copy link
Contributor

@eracah eracah commented Jan 4, 2023

What does this PR do?

logs just hparams passed directly to Trainer. Any non-[int, float, string, bool, None] objects are just logged as obj.__class__.__name__ instead of crawling them for haprams

What issue(s) does this change relate to?

fix CO-586
fix CO-203

Manual Test:

transform = transforms.Compose([transforms.ToTensor()])
train_set = datasets.MNIST("data", train=True, download=True, transform=transform)
val_set = datasets.MNIST("data", train=False, download=True, transform=transform)
train_dataloader = DataLoader(train_set, batch_size=128)
eval_dataloader = DataLoader(val_set, batch_size=64)
model=mnist_model(num_classes=10)


trainer = Trainer(
    model=model,
    train_dataloader=train_dataloader,
    eval_dataloader=eval_dataloader,
    max_duration="3ep",
    train_subset_num_batches=4,
    optimizers=[Adam(model.parameters(), eps=1e-3)],
    progress_bar=False,
    log_traces=False,
    log_to_console=True,
    console_log_interval='1ep',
    auto_log_hparams=True,
    algorithms=[ChannelsLast(), ColOut(), BlurPool()],
    callbacks=[SpeedMonitor(), MemoryMonitor(), ImageVisualizer()],
    loggers=[WandBLogger()],
)
trainer.fit()

Wandb Result
Console result:

Config:
algorithm_passes: null
algorithms:
- ChannelsLast
- ColOut
- BlurPool
auto_log_hparams: true
auto_microbatching: false
autoresume: false
blurpool/num_blurconv_layers: 0
blurpool/num_blurpool_layers: 0
callbacks:
- SpeedMonitor
- MemoryMonitor
- ImageVisualizer
console_log_interval: 1ep
console_stream: stderr
ddp_sync_strategy: null
deepspeed_config: null
deterministic_mode: false
device: DeviceCPU
device_train_microbatch_size: null
dist_timeout: 1800.0
eval_batch_split: 1
eval_dataloader: DataLoader
eval_interval: 1
eval_subset_num_batches: -1
fsdp_config: null
grad_accum: 1
latest_remote_file_name: null
load_exclude_algorithms: null
load_ignore_keys: null
load_object_store: null
load_path: null
load_progress_bar: true
load_strict_model_weights: false
load_weights_only: false
log_to_console: true
log_traces: false
loggers:
- WandBLogger
- ConsoleLogger
max_duration: 3ep
model: ComposerClassifier
num_cpus_per_node: 1
num_nodes: 1
num_optimizers: 1
optimizers:
- Adam
precision: Precision
profiler: null
progress_bar: false
python_log_level: null
rank_zero_seed: 791585187
remote_ud_has_format_string:
- false
- false
run_name: 1672804048-impossible-viper
save_filename: ep{epoch}-ba{batch}-rank{rank}.pt
save_folder: null
save_interval: 1ep
save_latest_filename: latest-rank{rank}.pt
save_num_checkpoints_to_keep: -1
save_overwrite: false
save_weights_only: false
scale_schedule_ratio: 1.0
schedulers: null
seed: 791585187
step_schedulers_every_batch: null
train_dataloader: DataLoader
train_dataloader_label: train
train_subset_num_batches: 4
using_device_microbatch_size: false

@eracah eracah marked this pull request as ready for review January 5, 2023 02:48
@eracah eracah requested a review from dakinggg January 5, 2023 02:48
composer/trainer/trainer.py Show resolved Hide resolved
composer/trainer/trainer.py Show resolved Hide resolved
composer/utils/auto_log_hparams.py Show resolved Hide resolved
tests/utils/test_autolog_hparams.py Outdated Show resolved Hide resolved
tests/utils/test_autolog_hparams.py Show resolved Hide resolved
@eracah eracah requested a review from dakinggg January 6, 2023 02:36
Copy link
Contributor

@dakinggg dakinggg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eracah eracah merged commit 5a0d071 into dev Jan 6, 2023
@eracah eracah deleted the new-auto-hp branch January 6, 2023 02:49
bmosaicml pushed a commit to bmosaicml/composer that referenced this pull request Jan 9, 2023
logs just hparams passed directly to Trainer. Any non-[int, float, string, bool, None] objects are just logged as obj.__class__.__name__ instead of crawling them for hparams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants