"src/sdk/pycli/vscode:/vscode.git/clone" did not exist on "88ef6c0492047a0fa5bdb7493d3bfd43b64605f6"
Unverified Commit e21a6984 authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

[v2.0] Refactor code hierarchy (part 2) (#2987)

parent f98ee672
...@@ -6,7 +6,7 @@ import logging ...@@ -6,7 +6,7 @@ import logging
import os import os
import netifaces import netifaces
from schema import Schema, And, Optional, Regex, Or, SchemaError from schema import Schema, And, Optional, Regex, Or, SchemaError
from nni.package_utils import create_validator_instance, get_all_builtin_names, get_builtin_algo_meta from nni.tools.package_utils import create_validator_instance, get_all_builtin_names, get_builtin_algo_meta
from .constants import SCHEMA_TYPE_ERROR, SCHEMA_RANGE_ERROR, SCHEMA_PATH_ERROR from .constants import SCHEMA_TYPE_ERROR, SCHEMA_RANGE_ERROR, SCHEMA_PATH_ERROR
from .common_utils import get_yml_content, print_warning from .common_utils import get_yml_content, print_warning
......
...@@ -9,8 +9,8 @@ import random ...@@ -9,8 +9,8 @@ import random
import time import time
import tempfile import tempfile
from subprocess import Popen, check_call, CalledProcessError, PIPE, STDOUT from subprocess import Popen, check_call, CalledProcessError, PIPE, STDOUT
from nni.nni_annotation import expand_annotations, generate_search_space from nni.tools.annotation import expand_annotations, generate_search_space
from nni.package_utils import get_builtin_module_class_name from nni.tools.package_utils import get_builtin_module_class_name
import nni_node import nni_node
from .launcher_utils import validate_all_content from .launcher_utils import validate_all_content
from .rest_utils import rest_put, rest_post, check_rest_server, check_response from .rest_utils import rest_put, rest_post, check_rest_server, check_response
......
...@@ -13,7 +13,7 @@ from functools import cmp_to_key ...@@ -13,7 +13,7 @@ from functools import cmp_to_key
from datetime import datetime, timezone from datetime import datetime, timezone
from subprocess import Popen from subprocess import Popen
from pyhdfs import HdfsClient from pyhdfs import HdfsClient
from nni.nni_annotation import expand_annotations from nni.tools.annotation import expand_annotations
import nni_node import nni_node
from .rest_utils import rest_get, rest_delete, check_rest_server_quick, check_response from .rest_utils import rest_get, rest_delete, check_rest_server_quick, check_response
from .url_utils import trial_jobs_url, experiment_url, trial_job_id_url, export_data_url, metric_data_url from .url_utils import trial_jobs_url, experiment_url, trial_job_id_url, export_data_url, metric_data_url
......
...@@ -6,7 +6,7 @@ from collections import defaultdict ...@@ -6,7 +6,7 @@ from collections import defaultdict
import json import json
import pkginfo import pkginfo
import nni import nni
from nni.package_utils import read_installed_package_meta, get_installed_package_meta, \ from nni.tools.package_utils import read_installed_package_meta, get_installed_package_meta, \
write_package_meta, get_builtin_algo_meta, get_not_installable_builtin_names, ALGO_TYPES write_package_meta, get_builtin_algo_meta, get_not_installable_builtin_names, ALGO_TYPES
from .constants import INSTALLABLE_PACKAGE_META from .constants import INSTALLABLE_PACKAGE_META
...@@ -19,7 +19,7 @@ def install_by_name(package_name): ...@@ -19,7 +19,7 @@ def install_by_name(package_name):
if package_name not in INSTALLABLE_PACKAGE_META: if package_name not in INSTALLABLE_PACKAGE_META:
raise RuntimeError('{} is not found in installable packages!'.format(package_name)) raise RuntimeError('{} is not found in installable packages!'.format(package_name))
requirements_path = os.path.join(nni.__path__[0], INSTALLABLE_PACKAGE_META[package_name]['code_sub_dir'], 'requirements.txt') requirements_path = os.path.join(nni.__path__[0], 'algorithms/hpo', INSTALLABLE_PACKAGE_META[package_name]['code_sub_dir'], 'requirements.txt')
assert os.path.exists(requirements_path) assert os.path.exists(requirements_path)
return install_requirements_command(requirements_path) return install_requirements_command(requirements_path)
......
# Copyright (c) Microsoft Corporation. # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license. # Licensed under the MIT license.
from collections import defaultdict
import importlib
import os import os
from pathlib import Path from pathlib import Path
import sys import sys
from collections import defaultdict
from pathlib import Path
import importlib
import ruamel.yaml as yaml import ruamel.yaml as yaml
import nni import nni
......
...@@ -5,87 +5,87 @@ BuiltinAlgorithms = { ...@@ -5,87 +5,87 @@ BuiltinAlgorithms = {
'tuners': [ 'tuners': [
{ {
'name': 'TPE', 'name': 'TPE',
'class_name': 'nni.hyperopt_tuner.hyperopt_tuner.HyperoptTuner', 'class_name': 'nni.algorithms.hpo.hyperopt_tuner.hyperopt_tuner.HyperoptTuner',
'class_args': { 'class_args': {
'algorithm_name': 'tpe' 'algorithm_name': 'tpe'
}, },
'class_args_validator': 'nni.hyperopt_tuner.hyperopt_tuner.HyperoptClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.hyperopt_tuner.hyperopt_tuner.HyperoptClassArgsValidator'
}, },
{ {
'name': 'Random', 'name': 'Random',
'class_name': 'nni.hyperopt_tuner.hyperopt_tuner.HyperoptTuner', 'class_name': 'nni.algorithms.hpo.hyperopt_tuner.hyperopt_tuner.HyperoptTuner',
'class_args': { 'class_args': {
'algorithm_name': 'random_search' 'algorithm_name': 'random_search'
}, },
'accept_class_args': False, 'accept_class_args': False,
'class_args_validator': 'nni.hyperopt_tuner.hyperopt_tuner.HyperoptClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.hyperopt_tuner.hyperopt_tuner.HyperoptClassArgsValidator'
}, },
{ {
'name': 'Anneal', 'name': 'Anneal',
'class_name': 'nni.hyperopt_tuner.hyperopt_tuner.HyperoptTuner', 'class_name': 'nni.algorithms.hpo.hyperopt_tuner.hyperopt_tuner.HyperoptTuner',
'class_args': { 'class_args': {
'algorithm_name': 'anneal' 'algorithm_name': 'anneal'
}, },
'class_args_validator': 'nni.hyperopt_tuner.hyperopt_tuner.HyperoptClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.hyperopt_tuner.hyperopt_tuner.HyperoptClassArgsValidator'
}, },
{ {
'name': 'Evolution', 'name': 'Evolution',
'class_name': 'nni.evolution_tuner.evolution_tuner.EvolutionTuner', 'class_name': 'nni.algorithms.hpo.evolution_tuner.evolution_tuner.EvolutionTuner',
'class_args_validator': 'nni.evolution_tuner.evolution_tuner.EvolutionClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.evolution_tuner.evolution_tuner.EvolutionClassArgsValidator'
}, },
{ {
'name': 'BatchTuner', 'name': 'BatchTuner',
'class_name': 'nni.batch_tuner.batch_tuner.BatchTuner', 'class_name': 'nni.algorithms.hpo.batch_tuner.batch_tuner.BatchTuner',
'accept_class_args': False, 'accept_class_args': False,
}, },
{ {
'name': 'GridSearch', 'name': 'GridSearch',
'class_name': 'nni.gridsearch_tuner.gridsearch_tuner.GridSearchTuner', 'class_name': 'nni.algorithms.hpo.gridsearch_tuner.gridsearch_tuner.GridSearchTuner',
'accept_class_args': False, 'accept_class_args': False,
}, },
{ {
'name': 'NetworkMorphism', 'name': 'NetworkMorphism',
'class_name': 'nni.networkmorphism_tuner.networkmorphism_tuner.NetworkMorphismTuner', 'class_name': 'nni.algorithms.hpo.networkmorphism_tuner.networkmorphism_tuner.NetworkMorphismTuner',
'class_args_validator': 'nni.networkmorphism_tuner.networkmorphism_tuner.NetworkMorphismClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.networkmorphism_tuner.networkmorphism_tuner.NetworkMorphismClassArgsValidator'
}, },
{ {
'name': 'MetisTuner', 'name': 'MetisTuner',
'class_name': 'nni.metis_tuner.metis_tuner.MetisTuner', 'class_name': 'nni.algorithms.hpo.metis_tuner.metis_tuner.MetisTuner',
'class_args_validator': 'nni.metis_tuner.metis_tuner.MetisClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.metis_tuner.metis_tuner.MetisClassArgsValidator'
}, },
{ {
'name': 'GPTuner', 'name': 'GPTuner',
'class_name': 'nni.gp_tuner.gp_tuner.GPTuner', 'class_name': 'nni.algorithms.hpo.gp_tuner.gp_tuner.GPTuner',
'class_args_validator': 'nni.gp_tuner.gp_tuner.GPClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.gp_tuner.gp_tuner.GPClassArgsValidator'
}, },
{ {
'name': 'PBTTuner', 'name': 'PBTTuner',
'class_name': 'nni.pbt_tuner.pbt_tuner.PBTTuner', 'class_name': 'nni.algorithms.hpo.pbt_tuner.pbt_tuner.PBTTuner',
'class_args_validator': 'nni.pbt_tuner.pbt_tuner.PBTClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.pbt_tuner.pbt_tuner.PBTClassArgsValidator'
}, },
{ {
'name': 'RegularizedEvolutionTuner', 'name': 'RegularizedEvolutionTuner',
'class_name': 'nni.regularized_evolution_tuner.regularized_evolution_tuner.RegularizedEvolutionTuner', 'class_name': 'nni.algorithms.hpo.regularized_evolution_tuner.regularized_evolution_tuner.RegularizedEvolutionTuner',
'class_args_validator': 'nni.regularized_evolution_tuner.regularized_evolution_tuner.EvolutionClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.regularized_evolution_tuner.regularized_evolution_tuner.EvolutionClassArgsValidator'
} }
], ],
'assessors': [ 'assessors': [
{ {
'name': 'Medianstop', 'name': 'Medianstop',
'class_name': 'nni.medianstop_assessor.medianstop_assessor.MedianstopAssessor', 'class_name': 'nni.algorithms.hpo.medianstop_assessor.medianstop_assessor.MedianstopAssessor',
'class_args_validator': 'nni.medianstop_assessor.medianstop_assessor.MedianstopClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.medianstop_assessor.medianstop_assessor.MedianstopClassArgsValidator'
}, },
{ {
'name': 'Curvefitting', 'name': 'Curvefitting',
'class_name': 'nni.curvefitting_assessor.curvefitting_assessor.CurvefittingAssessor', 'class_name': 'nni.algorithms.hpo.curvefitting_assessor.curvefitting_assessor.CurvefittingAssessor',
'class_args_validator': 'nni.curvefitting_assessor.curvefitting_assessor.CurvefittingClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.curvefitting_assessor.curvefitting_assessor.CurvefittingClassArgsValidator'
}, },
], ],
'advisors': [ 'advisors': [
{ {
'name': 'Hyperband', 'name': 'Hyperband',
'class_name': 'nni.hyperband_advisor.hyperband_advisor.Hyperband', 'class_name': 'nni.algorithms.hpo.hyperband_advisor.hyperband_advisor.Hyperband',
'class_args_validator': 'nni.hyperband_advisor.hyperband_advisor.HyperbandClassArgsValidator' 'class_args_validator': 'nni.algorithms.hpo.hyperband_advisor.hyperband_advisor.HyperbandClassArgsValidator'
} }
] ]
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment