Coder Social home page Coder Social logo

Comments (2)

ShunLu91 avatar ShunLu91 commented on May 27, 2024 1

Thanks for such in-time reply.
Though some lines of the code need to be modified to adapt with the newest NAS-Bench-201 API, it solved my problem just right!
Great thanks and best wishes.

from aw_nas.

walkerning avatar walkerning commented on May 27, 2024

Hi, thanks for your attention on our work. I try to find this python script on my server, it seems like I use this script:

# -*- coding: utf-8 -*-
# pylint: disable-all
import pickle
import numpy as np
from aw_nas.common import get_search_space
from nas_201_api import NASBench201API as API

search_space = get_search_space("nasbench-201")
num_arch = len(search_space.api)
print("Number of arch data: {}".format(num_arch))
api = search_space.api

# valid_ratio = 0.1
valid_ratio = 0.5
num_valid = int(num_arch * valid_ratio)
train_data = []
for i in range(num_arch - num_valid):
    # first use cifar10!
    # all 200 epoch, epoch maybe use epoch 150 is better.. let's try
    arch_res = api.query_by_index(i)
    arch = API.str2matrix(arch_res.arch_str)
    accs = [[res.eval_acc1es["ori-test@99"], res.eval_acc1es["ori-test@149"], res.eval_acc1es["ori-test@199"]] for res in arch_res.query("cifar10").values()]
    test_accs = np.mean(accs, axis=0) / 100.
    train_data.append((arch, test_accs[2], test_accs[1]))

valid_data = []
for i in range(num_arch - num_valid, num_arch):
    # first use cifar10!
    # all 200 epoch, epoch maybe use epoch 150 is better.. let's try
    arch_res = api.query_by_index(i)
    arch = API.str2matrix(arch_res.arch_str)
    accs = [[res.eval_acc1es["ori-test@99"], res.eval_acc1es["ori-test@149"], res.eval_acc1es["ori-test@199"]] for res in arch_res.query("cifar10").values()]
    test_accs = np.mean(accs, axis=0) / 100.
    valid_data.append((arch, test_accs[2], test_accs[1]))


with open("nasbench201_05.pkl", "wb") as wf:
    pickle.dump(train_data, wf)
with open("nasbench201_05_valid.pkl", "wb") as wf:
    pickle.dump(valid_data, wf)

You'll need NAS-Bench-201 installed, and GATES uses the very first version of the NAS-Bench-201 repository (only this very first version is available at that time), the name of the data file is NAS-Bench-201-v1_0-e61699.pth.

from aw_nas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.