A work-in-progress implementation of Compressed Network Search for PyTorch models.
This creates a genome per layer, rather than a single one for the entire model as is described in the paper.
from cnslib.population import Population
from yourcool.lib import Model
...
population = Population(lambda: Model(), yourconfig.num_models, yourconfig.cuda)
...
criterion = nn.BCELoss()
...training loop...
population.generation(batch_input, batch_output, criterion) # update the population
best_model = population.best_model() # current best model
- Download this repo
pip install .
inside repo
cnsdcgan.py
: DCGAN adapted from the PyTorch DCGAN example. Trains both
the discriminator and generator with compressed network search.