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
e21a6984
Unverified
Commit
e21a6984
authored
Oct 26, 2020
by
liuzhe-lz
Committed by
GitHub
Oct 26, 2020
Browse files
[v2.0] Refactor code hierarchy (part 2) (#2987)
parent
f98ee672
Changes
231
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
17 additions
and
11 deletions
+17
-11
nni/nas/pytorch/mutator.py
nni/nas/pytorch/mutator.py
+1
-1
nni/runtime/common.py
nni/runtime/common.py
+4
-0
nni/runtime/env_vars.py
nni/runtime/env_vars.py
+0
-0
nni/runtime/msg_dispatcher.py
nni/runtime/msg_dispatcher.py
+2
-2
nni/runtime/msg_dispatcher_base.py
nni/runtime/msg_dispatcher_base.py
+2
-2
nni/runtime/platform/__init__.py
nni/runtime/platform/__init__.py
+0
-0
nni/runtime/platform/local.py
nni/runtime/platform/local.py
+1
-1
nni/runtime/platform/standalone.py
nni/runtime/platform/standalone.py
+0
-0
nni/runtime/platform/test.py
nni/runtime/platform/test.py
+0
-0
nni/runtime/protocol.py
nni/runtime/protocol.py
+4
-2
nni/smartparam.py
nni/smartparam.py
+2
-2
nni/tools/annotation/.gitignore
nni/tools/annotation/.gitignore
+0
-0
nni/tools/annotation/__init__.py
nni/tools/annotation/__init__.py
+0
-0
nni/tools/annotation/code_generator.py
nni/tools/annotation/code_generator.py
+0
-0
nni/tools/annotation/search_space_generator.py
nni/tools/annotation/search_space_generator.py
+0
-0
nni/tools/annotation/specific_code_generator.py
nni/tools/annotation/specific_code_generator.py
+1
-1
nni/tools/annotation/utils.py
nni/tools/annotation/utils.py
+0
-0
nni/tools/gpu_tool/__init__.py
nni/tools/gpu_tool/__init__.py
+0
-0
nni/tools/gpu_tool/gpu_metrics_collector.py
nni/tools/gpu_tool/gpu_metrics_collector.py
+0
-0
nni/tools/nnictl/__init__.py
nni/tools/nnictl/__init__.py
+0
-0
No files found.
nni/nas/pytorch/mutator.py
View file @
e21a6984
...
...
@@ -107,7 +107,7 @@ class Mutator(BaseMutator):
"""
if
not
torch
.
__version__
.
startswith
(
"1.4"
):
logger
.
warning
(
"Graph is only tested with PyTorch 1.4. Other versions might not work."
)
from
nni.
_
graph_utils
import
build_graph
from
nni.
common.
graph_utils
import
build_graph
from
google.protobuf
import
json_format
# protobuf should be installed as long as tensorboard is installed
try
:
...
...
nni/common.py
→
nni/
runtime/
common.py
View file @
e21a6984
...
...
@@ -4,6 +4,7 @@
from
datetime
import
datetime
from
io
import
TextIOBase
import
logging
import
os
import
sys
import
time
...
...
@@ -33,6 +34,9 @@ def init_logger(logger_file_path, log_level_name='info'):
This will redirect anything from logging.getLogger() as well as stdout to specified file.
logger_file_path: path of logger file (path-like object).
"""
if
os
.
environ
.
get
(
'NNI_PLATFORM'
)
==
'unittest'
:
return
# fixme: launching logic needs refactor
log_level
=
log_level_map
.
get
(
log_level_name
,
logging
.
INFO
)
logger_file
=
open
(
logger_file_path
,
'w'
)
fmt
=
'[%(asctime)s] %(levelname)s (%(name)s/%(threadName)s) %(message)s'
...
...
nni/env_vars.py
→
nni/
runtime/
env_vars.py
View file @
e21a6984
File moved
nni/msg_dispatcher.py
→
nni/
runtime/
msg_dispatcher.py
View file @
e21a6984
...
...
@@ -8,10 +8,10 @@ import json_tricks
from
nni
import
NoMoreTrialError
from
.protocol
import
CommandType
,
send
from
.msg_dispatcher_base
import
MsgDispatcherBase
from
.assessor
import
AssessResult
from
nni
.assessor
import
AssessResult
from
.common
import
multi_thread_enabled
,
multi_phase_enabled
from
.env_vars
import
dispatcher_env_vars
from
.utils
import
MetricType
,
to_json
from
.
.utils
import
MetricType
,
to_json
_logger
=
logging
.
getLogger
(
__name__
)
...
...
nni/msg_dispatcher_base.py
→
nni/
runtime/
msg_dispatcher_base.py
View file @
e21a6984
...
...
@@ -9,8 +9,8 @@ import json_tricks
from
.common
import
multi_thread_enabled
from
.env_vars
import
dispatcher_env_vars
from
.utils
import
init_dispatcher_logger
from
.recoverable
import
Recoverable
from
.
.utils
import
init_dispatcher_logger
from
.
.recoverable
import
Recoverable
from
.protocol
import
CommandType
,
receive
init_dispatcher_logger
()
...
...
nni/platform/__init__.py
→
nni/
runtime/
platform/__init__.py
View file @
e21a6984
File moved
nni/platform/local.py
→
nni/
runtime/
platform/local.py
View file @
e21a6984
...
...
@@ -9,7 +9,7 @@ import subprocess
from
..common
import
init_logger
from
..env_vars
import
trial_env_vars
from
.
.utils
import
to_json
from
nni
.utils
import
to_json
_sysdir
=
trial_env_vars
.
NNI_SYS_DIR
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
_sysdir
,
'.nni'
)):
...
...
nni/platform/standalone.py
→
nni/
runtime/
platform/standalone.py
View file @
e21a6984
File moved
nni/platform/test.py
→
nni/
runtime/
platform/test.py
View file @
e21a6984
File moved
nni/protocol.py
→
nni/
runtime/
protocol.py
View file @
e21a6984
...
...
@@ -2,6 +2,7 @@
# Licensed under the MIT license.
import
logging
import
os
import
threading
from
enum
import
Enum
...
...
@@ -27,8 +28,9 @@ class CommandType(Enum):
_lock
=
threading
.
Lock
()
try
:
_in_file
=
open
(
3
,
'rb'
)
_out_file
=
open
(
4
,
'wb'
)
if
os
.
environ
.
get
(
'NNI_PLATFORM'
)
!=
'unittest'
:
_in_file
=
open
(
3
,
'rb'
)
_out_file
=
open
(
4
,
'wb'
)
except
OSError
:
_msg
=
'IPC pipeline not exists, maybe you are importing tuner/assessor from trial code?'
logging
.
getLogger
(
__name__
).
warning
(
_msg
)
...
...
nni/smartparam.py
View file @
e21a6984
...
...
@@ -3,10 +3,10 @@
import
numpy
as
np
from
.env_vars
import
trial_env_vars
from
.runtime
.env_vars
import
trial_env_vars
from
.
import
trial
from
.
import
parameter_expressions
as
param_exp
from
.nas_utils
import
classic_mode
,
enas_mode
,
oneshot_mode
,
darts_mode
from
.common
.nas_utils
import
classic_mode
,
enas_mode
,
oneshot_mode
,
darts_mode
__all__
=
[
...
...
nni/
nni_
annotation/.gitignore
→
nni/
tools/
annotation/.gitignore
View file @
e21a6984
File moved
nni/
nni_
annotation/__init__.py
→
nni/
tools/
annotation/__init__.py
View file @
e21a6984
File moved
nni/
nni_
annotation/code_generator.py
→
nni/
tools/
annotation/code_generator.py
View file @
e21a6984
File moved
nni/
nni_
annotation/search_space_generator.py
→
nni/
tools/
annotation/search_space_generator.py
View file @
e21a6984
File moved
nni/
nni_
annotation/specific_code_generator.py
→
nni/
tools/
annotation/specific_code_generator.py
View file @
e21a6984
...
...
@@ -3,7 +3,7 @@
import
ast
import
astor
from
nni.
nni_cmd
.common_utils
import
print_warning
from
nni.
tools.nnictl
.common_utils
import
print_warning
from
.utils
import
ast_Num
,
ast_Str
...
...
nni/
nni_
annotation/utils.py
→
nni/
tools/
annotation/utils.py
View file @
e21a6984
File moved
nni/
nni_
gpu_tool/__init__.py
→
nni/
tools/
gpu_tool/__init__.py
View file @
e21a6984
File moved
nni/
nni_
gpu_tool/gpu_metrics_collector.py
→
nni/
tools/
gpu_tool/gpu_metrics_collector.py
View file @
e21a6984
File moved
nni/
nni_trial_too
l/__init__.py
→
nni/
tools/nnict
l/__init__.py
View file @
e21a6984
File moved
Prev
1
…
5
6
7
8
9
10
11
12
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