Skip to content

ZIB-IOL/approximating-neural-network-manifolds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VI-Net

This page describes the setup to run experiments.

Setting up the Conda Environment

To set up the Conda environment for running experiments, follow these steps:

  1. Ensure you have Conda installed on your system. If not, you can download and install it from here.

  2. Run the following command to create the Conda environment in the VI-Net directory:

    conda env create -f environment.yaml
  3. Activate the newly created environment:

    conda activate icml_vinet

Weights and Biases

Next you need to setup a free account on weights and biases see [https://wandb.ai/site/][https://wandb.ai/site/]. This will be used to save model weights etc.

VI-Net pipeline

Note that we used an internal Caching module for the dataset caching for our experiments which we can unfortunately not share. Therefore one can currently only run experiments on CIFAR10 and CIFAR100, rather than all ImageNet Tiny.

Train the baseline model

To train a baseline we create a sweep with the sweep script. First make it executable.

chmod +x sweep.sh

You can now use this script to create a sweep for training a ResNet18 on CIFAR10 as follows.

./sweep.sh \
--seed 42 \
--model local_resnet18 \
--pretrained false \
--use_artifact false \
--num_classes 10 \
--linear_layer_name fc \
--spatial_reduction_factor 1 \
--fc_squeeze_linear true \
--flatten true \
--epochs 100 \
--checkpoint_metric val_acc \
--save_checkpoints false \
--save_last_checkpoint true \
--top_k_checkpoints 3 \
--optimizer sgd \
--gradient_clip false \
--lr 0.01 \
--weight_decay 0.00005 \
--momentum 0.9 \
--nesterov true \
--lr_linear_decay true \
--lr_scheduler linear \
--warmup_fraction 0.05 \
--log_wandb true \
--use_amp false \
--amp_bf16 false \
--gradient_checkpointing false \
--dropout_rate 0.0 \
--dataset cifar10 \
--batch_size 256 \
--val_split 0.05 \
--random_horizontal_flip true \
--img_format BCHW \
--psi 0.1 \
--decay_factor 1 \
--max_pols_per_class 10 \
--max_monomials 10000 \
--oavi_batch_size 256 \
--oavi_oracle ABM \
--aggregation concat \
--batch_norm true \
--combine true \
--max_oavi_parallel_jobs 2 \
--freeze_coefficients false \
--freeze_non_zero false \
--partition pca \
--pca_components 128 \
--partition_spatial_pca 1 \
--max_pool 1 \
--max_degree 5 \
--subsample_size_vanishing 512 \
--polynomial_prune false \
--monomial_prune false \
--load_project VI-Net-baseline-cifar10 \
--load_layer_extract layer4.1.bn1 \
--experiment baseline \
--full_local true \
--project_name VI-Net-baseline-cifar10_rebuttal

This will then yield an output of the form

wandb: Creating sweep from: sweep.yaml
wandb: Creating sweep with ID: 12345678
wandb: View sweep at: https://wandb.ai/user-name/project/sweeps/12345678
wandb: Run sweep agent with: wandb agent user-name/project/12345678

Then run the sweep with the generated command as above. The model will be trained and stored in the project VI-Net-baseline-cifar10_rebuttal.

Train the VI-Net

To train the VI-Net one creates again a sweep and runs it. For the CIFAR10, one would run

./sweep.sh \
--seed 42 \
--model local_resnet18 \
--pretrained false \
--use_artifact false \
--num_classes 10 \
--linear_layer_name fc \
--spatial_reduction_factor 1 \
--fc_squeeze_linear true \
--flatten true \
--epochs 20 \
--checkpoint_metric val_acc \
--save_checkpoints false \
--save_last_checkpoint true \
--top_k_checkpoints 3 \
--optimizer sgd \
--gradient_clip false \
--lr 0.01 \
--weight_decay 0.00005 \
--momentum 0.9 \
--nesterov true \
--lr_linear_decay true \
--lr_scheduler linear \
--warmup_fraction 0.05 \
--log_wandb true \
--use_amp false \
--amp_bf16 false \
--gradient_checkpointing false \
--dropout_rate 0.0 \
--dataset cifar10 \
--batch_size 256 \
--val_split 0.05 \
--random_horizontal_flip true \
--img_format BCHW \
--psi 0.1 \
--decay_factor 1 \
--max_pols_per_class 10 \
--max_monomials 10000 \
--oavi_batch_size 256 \
--oavi_oracle ABM \
--aggregation concat \
--batch_norm true \
--combine true \
--max_oavi_parallel_jobs 2 \
--freeze_coefficients false \
--freeze_non_zero false \
--partition pca \
--pca_components 128 \
--partition_spatial_pca 1 \
--max_pool 1 \
--max_degree 5 \
--subsample_size_vanishing 512 \
--polynomial_prune false \
--monomial_prune false \
--load_project VI-Net-baseline-cifar10_rebuttal \
--load_layer_extract layer4.1.bn1 \
--experiment vinet \
--full_local true \
--project_name VI-Net-vinet-cifar10_rebuttal

Run parameters

Model Identifiers

For CIFAR-10:

  • ResNet-18: local_resnet18
  • ResNet-34: local_resnet34
  • ResNet-50: local_resnet50

For CIFAR-100:

  • ResNet-18: local_resnet18_cifar100
  • ResNet-34: local_resnet34_cifar100
  • ResNet-50: local_resnet50_cifar100

Dataset

  • CIFAR10: cifar10
  • CIFAR100: cifar100

Also make sure that num_classes matches the number of classes of the dataset.

Experiment type

  • VI-Net: vinet
  • Baseline model: baseline
  • Inference test: performance
  • Linear baseline: linear

About

Code for the paper "Approximating Latent Manifolds in Neural Networks via Vanishing Ideals"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors