facebookresearch / AttentiveNAS

code for "AttentiveNAS Improving Neural Architecture Search via Attentive Sampling"
Other
103 stars 21 forks source link

Codes about evolutionary search on the ImageNet validation set #4

Closed chenbohua3 closed 3 years ago

chenbohua3 commented 3 years ago

It seems that the codes about evolutionary search are not included in this repo, will you guys open source them?

Also, the codes for generating the look-up table are also not included, it will be useful to have them:)

dilinwang820 commented 3 years ago

Hi - searching the best model of interest is often case dependent and requires some application specific adaptations. That's why we excluded the searching code in our repo. There're two key steps for our evolutionary search, i.e., mutate and crossover. See an implementation example below. Starting from these two functions, it should be quite straightforward to implement a search to your purpose.

def cfg_mutate(old_cfg, search_space, prob=0.2):
    new_cfg = search_space.sample()  #randomly sample a sub-network
    return [oc if random.random() > prob else nc for oc, nc in zip(old_cfg, new_cfg)]

def cfg_crossover(self, cfg1, cfg2, prob=0.5):
    return [c1 if random.random() > prob else c2 for c1, c2 in zip(cfg1, cfg2)]