Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
f98ee672
Unverified
Commit
f98ee672
authored
Oct 20, 2020
by
liuzhe-lz
Committed by
GitHub
Oct 20, 2020
Browse files
[v2.0] Refactor code hierarchy (part 1) (#2962)
parent
f1105409
Changes
645
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
5 additions
and
45 deletions
+5
-45
nni/nni_trial_tool/commands.py
nni/nni_trial_tool/commands.py
+0
-0
nni/nni_trial_tool/constants.py
nni/nni_trial_tool/constants.py
+0
-0
nni/nni_trial_tool/file_channel.py
nni/nni_trial_tool/file_channel.py
+0
-0
nni/nni_trial_tool/gpu.py
nni/nni_trial_tool/gpu.py
+0
-0
nni/nni_trial_tool/hdfsClientUtility.py
nni/nni_trial_tool/hdfsClientUtility.py
+0
-0
nni/nni_trial_tool/log_utils.py
nni/nni_trial_tool/log_utils.py
+0
-0
nni/nni_trial_tool/rest_utils.py
nni/nni_trial_tool/rest_utils.py
+0
-0
nni/nni_trial_tool/trial.py
nni/nni_trial_tool/trial.py
+0
-0
nni/nni_trial_tool/trial_keeper.py
nni/nni_trial_tool/trial_keeper.py
+0
-0
nni/nni_trial_tool/trial_runner.py
nni/nni_trial_tool/trial_runner.py
+0
-0
nni/nni_trial_tool/url_utils.py
nni/nni_trial_tool/url_utils.py
+0
-0
nni/nni_trial_tool/web_channel.py
nni/nni_trial_tool/web_channel.py
+0
-0
nni/nnicli/__init__.py
nni/nnicli/__init__.py
+0
-0
nni/nnicli/nni_client.py
nni/nnicli/nni_client.py
+1
-1
nni/package_utils.py
nni/package_utils.py
+4
-44
nni/parameter_expressions.py
nni/parameter_expressions.py
+0
-0
nni/pbt_tuner/__init__.py
nni/pbt_tuner/__init__.py
+0
-0
nni/pbt_tuner/pbt_tuner.py
nni/pbt_tuner/pbt_tuner.py
+0
-0
nni/platform/__init__.py
nni/platform/__init__.py
+0
-0
nni/platform/local.py
nni/platform/local.py
+0
-0
No files found.
tools
/nni_trial_tool/commands.py
→
nni
/nni_trial_tool/commands.py
View file @
f98ee672
File moved
tools
/nni_trial_tool/constants.py
→
nni
/nni_trial_tool/constants.py
View file @
f98ee672
File moved
tools
/nni_trial_tool/file_channel.py
→
nni
/nni_trial_tool/file_channel.py
View file @
f98ee672
File moved
tools
/nni_trial_tool/gpu.py
→
nni
/nni_trial_tool/gpu.py
View file @
f98ee672
File moved
tools
/nni_trial_tool/hdfsClientUtility.py
→
nni
/nni_trial_tool/hdfsClientUtility.py
View file @
f98ee672
File moved
tools
/nni_trial_tool/log_utils.py
→
nni
/nni_trial_tool/log_utils.py
View file @
f98ee672
File moved
tools
/nni_trial_tool/rest_utils.py
→
nni
/nni_trial_tool/rest_utils.py
View file @
f98ee672
File moved
tools
/nni_trial_tool/trial.py
→
nni
/nni_trial_tool/trial.py
View file @
f98ee672
File moved
tools
/nni_trial_tool/trial_keeper.py
→
nni
/nni_trial_tool/trial_keeper.py
View file @
f98ee672
File moved
tools
/nni_trial_tool/trial_runner.py
→
nni
/nni_trial_tool/trial_runner.py
View file @
f98ee672
File moved
tools
/nni_trial_tool/url_utils.py
→
nni
/nni_trial_tool/url_utils.py
View file @
f98ee672
File moved
tools
/nni_trial_tool/web_channel.py
→
nni
/nni_trial_tool/web_channel.py
View file @
f98ee672
File moved
src/sdk/pycl
i/nnicli/__init__.py
→
nn
i/nnicli/__init__.py
View file @
f98ee672
File moved
src/sdk/pycl
i/nnicli/nni_client.py
→
nn
i/nnicli/nni_client.py
View file @
f98ee672
...
...
@@ -5,7 +5,7 @@
Example:
from nnicli import Experiment
from
nni.
nnicli import Experiment
exp = Experiment()
exp.start_experiment('../../../../examples/trials/mnist-pytorch/config.yml')
...
...
src/sdk/pynni/
nni/package_utils.py
→
nni/package_utils.py
View file @
f98ee672
...
...
@@ -2,13 +2,14 @@
# Licensed under the MIT license.
import
os
import
site
from
pathlib
import
Path
import
sys
from
collections
import
defaultdict
from
pathlib
import
Path
import
importlib
import
ruamel.yaml
as
yaml
import
nni
from
.constants
import
BuiltinAlgorithms
ALGO_TYPES
=
[
'tuners'
,
'assessors'
,
'advisors'
]
...
...
@@ -286,50 +287,9 @@ def create_customized_class_instance(class_params):
return
instance
def
get_nni_installation_parent_dir
():
''' Find nni installation parent directory
'''
if
os
.
getenv
(
'VIRTUAL_ENV'
):
# if 'virtualenv' package is used, `site` has not attr getsitepackages, so we will instead use VIRTUAL_ENV
# Note that conda venv will not have VIRTUAL_ENV
python_dir
=
os
.
getenv
(
'VIRTUAL_ENV'
)
else
:
python_sitepackage
=
site
.
getsitepackages
()[
0
]
# If system-wide python is used, we will give priority to using `local sitepackage`--"usersitepackages()" given
# that nni exists there
if
python_sitepackage
.
startswith
(
'/usr'
)
or
python_sitepackage
.
startswith
(
'/Library'
):
python_dir
=
_try_installation_path_sequentially
(
site
.
getusersitepackages
(),
*
site
.
getsitepackages
())
else
:
python_dir
=
_try_installation_path_sequentially
(
*
site
.
getsitepackages
(),
site
.
getusersitepackages
())
return
python_dir
def
_try_installation_path_sequentially
(
*
sitepackages
):
'''Try different installation path sequentially util nni is found.
Return None if nothing is found
'''
for
sitepackage
in
sitepackages
:
path
=
Path
(
sitepackage
)
if
len
(
path
.
parents
)
>
2
and
(
path
.
parents
[
2
]
/
'nni'
/
'main.js'
).
is_file
():
return
str
(
path
.
parents
[
2
])
if
(
path
/
'nni'
/
'main.js'
).
is_file
():
return
str
(
path
)
return
None
def
get_nni_installation_path
():
''' Find nni installation directory
'''
parent_dir
=
get_nni_installation_parent_dir
()
if
parent_dir
:
entry_file
=
os
.
path
.
join
(
parent_dir
,
'nni'
,
'main.js'
)
if
os
.
path
.
isfile
(
entry_file
):
return
os
.
path
.
join
(
parent_dir
,
'nni'
)
return
None
def
get_nni_config_dir
():
return
os
.
path
.
join
(
get_nni_installation_path
(),
'config'
)
def
get_package_config_path
():
config_dir
=
get_nni_config_dir
()
# FIXME: this might not be the desired location
config_dir
=
Path
(
nni
.
__path__
[
0
]).
parent
/
'nni_config'
if
not
os
.
path
.
exists
(
config_dir
):
os
.
makedirs
(
config_dir
,
exist_ok
=
True
)
return
os
.
path
.
join
(
config_dir
,
'installed_packages.yml'
)
...
...
src/sdk/pynni/
nni/parameter_expressions.py
→
nni/parameter_expressions.py
View file @
f98ee672
File moved
tools/nni_trial_tool
/__init__.py
→
nni/pbt_tuner
/__init__.py
View file @
f98ee672
File moved
src/sdk/pynni/
nni/pbt_tuner/pbt_tuner.py
→
nni/pbt_tuner/pbt_tuner.py
View file @
f98ee672
File moved
src/sdk/pynni/
nni/platform/__init__.py
→
nni/platform/__init__.py
View file @
f98ee672
File moved
src/sdk/pynni/
nni/platform/local.py
→
nni/platform/local.py
View file @
f98ee672
File moved
Prev
1
…
13
14
15
16
17
18
19
20
21
…
33
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment