bfas

Brute Force Architecture Search


Keywords
bfas, efficient, deep, learning, NAS, neural, architecture, search, knowledge, distillation, deep-learning, deep-neural-networks, hyperparameter-optimization, mlops, model-comparison, model-compression, neural-architecture-search, python, pytorch, random-search
License
Apache-2.0
Install
pip install bfas==0.0.5

Documentation

BFAS

Brute Force Architecture Search

This repository aims to find neural network architecture that shows best performance on your hardware.


Usage

  1. Create your files

  1. Install BFAS with pip
pip install bfas
  1. Run
#app.py
from bfas import BFAS
from bfas.utils.data_types import *

bfas = BFAS(project_name="bfas",
            archname="mobilenetv2_custom",
            archs_dir = "archs",
            device="cpu",
            logger_name="tensorboard",
            is_logging_active=True,
            seed=28,
            )

bfas.rules.addRule(Rule(Metrics.FPS, Limit.MIN, 1))
bfas.rules.addRule(Rule(Metrics.PARAMCOUNT, Limit.MAX, 10))
bfas.run(iter_count=5)

Description

  1. Architecture file (archname.py)

This file contains your neural network architecture. It has Net (torch.nn.module) and the net takes your variables as arguments.

  1. Variables file (archname.json)

This file contains information about your variables that in your neural network. We define 2 types variable as "range", "array". The range variable have start, end and step values. This type variables can have range of values. The array variable have a list of item. In parameter sampling process, parameters sampled from this array.

  1. Application file (app.py)

In this file, you can create your bfas experiments. It contains codes like;

from bfas import BFAS
from bfas.utils.data_types import *

bfas = BFAS(project_name="bfas",
            archname="resnet50_custom",
            archs_dir = "archs",
            device="mps",
            logger_name="wandb",
            is_logging_active=True,
            seed=25,
            is_training_active=True,
            dataset="cifar10",
            batch_size=16,
            test_step=5,
            train_step=50,
            )

bfas.rules.addRule(Rule(Metrics.FPS, Limit.MIN, 20))
bfas.rules.addRule(Rule(Metrics.PARAMCOUNT, Limit.MIN, 20))
bfas.run(iter_count=10)

Here, We import the BFAS module and related data_types such as Rule, FPS metric etc. After that, We create BFAS object with necessarly arguments. Then, We add the rules for "brute force architecture search" process. If the model can suitable to our rules, we can add this model and their parameter to our logs. This rule adding step is optional. If you don't add any rule, all resulst are going to save to logs. The last operation is run the experiments. You can set iteration count before the running the experiment.

Note If you want see detailed information about creating environment and designing your experiment, You can look at guide.

Wandb logging example here:

Note You can see our development plan and open tasks for this project from todo document .

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request