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
f4bcda10
"vscode:/vscode.git/clone" did not exist on "c84ba2578454ef12bbf6a3d8560f9fc27ad81038"
Unverified
Commit
f4bcda10
authored
Apr 27, 2022
by
liuzhe-lz
Committed by
GitHub
Apr 27, 2022
Browse files
Replace nni.typehint with typing_extensions (#4802)
parent
290824c1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
17 deletions
+12
-17
nni/algorithms/hpo/medianstop_assessor.py
nni/algorithms/hpo/medianstop_assessor.py
+2
-1
nni/algorithms/hpo/tpe_tuner.py
nni/algorithms/hpo/tpe_tuner.py
+1
-1
nni/retiarii/strategy/_rl_impl.py
nni/retiarii/strategy/_rl_impl.py
+1
-1
nni/tools/package_utils/common.py
nni/tools/package_utils/common.py
+1
-1
nni/tools/package_utils/tuner_factory.py
nni/tools/package_utils/tuner_factory.py
+2
-1
nni/typehint.py
nni/typehint.py
+5
-12
No files found.
nni/algorithms/hpo/medianstop_assessor.py
View file @
f4bcda10
...
...
@@ -4,11 +4,12 @@
from
__future__
import
annotations
import
logging
from
schema
import
Schema
,
Optional
from
typing_extensions
import
Literal
from
nni
import
ClassArgsValidator
from
nni.assessor
import
Assessor
,
AssessResult
from
nni.typehint
import
Literal
from
nni.utils
import
extract_scalar_history
logger
=
logging
.
getLogger
(
'medianstop_Assessor'
)
...
...
nni/algorithms/hpo/tpe_tuner.py
View file @
f4bcda10
...
...
@@ -22,10 +22,10 @@ from typing import Any, NamedTuple
import
numpy
as
np
from
scipy.special
import
erf
# pylint: disable=no-name-in-module
from
typing_extensions
import
Literal
from
nni.common.hpo_utils
import
Deduplicator
,
OptimizeMode
,
format_search_space
,
deformat_parameters
,
format_parameters
from
nni.tuner
import
Tuner
from
nni.typehint
import
Literal
from
nni.utils
import
extract_scalar_reward
from
.
import
random_tuner
...
...
nni/retiarii/strategy/_rl_impl.py
View file @
f4bcda10
...
...
@@ -19,7 +19,7 @@ from gym import spaces
from
tianshou.data
import
to_torch
from
tianshou.env.worker
import
EnvWorker
from
nni.typehint
import
TypedDict
from
typing_extensions
import
TypedDict
from
.utils
import
get_targeted_model
from
..graph
import
ModelStatus
...
...
nni/tools/package_utils/common.py
View file @
f4bcda10
...
...
@@ -7,7 +7,7 @@ __all__ = ['AlgoMeta']
from
typing
import
NamedTuple
from
nni.typehint
import
Literal
from
typing_extensions
import
Literal
class
AlgoMeta
(
NamedTuple
):
name
:
str
...
...
nni/tools/package_utils/tuner_factory.py
View file @
f4bcda10
...
...
@@ -13,7 +13,8 @@ import os
import
sys
from
typing
import
Any
from
nni.typehint
import
Literal
from
typing_extensions
import
Literal
from
.
import
config_manager
ALGO_TYPES
=
[
'tuners'
,
'assessors'
]
...
...
nni/typehint.py
View file @
f4bcda10
...
...
@@ -5,18 +5,11 @@
Types for static checking.
"""
__all__
=
[
'Literal'
,
'TypedDict'
,
'Parameters'
,
'SearchSpace'
,
'TrialMetric'
,
'TrialRecord'
,
]
import
sys
from
typing
import
Any
,
Dict
,
List
,
TYPE_CHECKING
if
TYPE_CHECKING
or
sys
.
version_info
>=
(
3
,
8
):
from
typing
import
Literal
,
TypedDict
else
:
from
typing_extensions
import
Literal
,
TypedDict
__all__
=
[
'Parameters'
,
'SearchSpace'
,
'TrialMetric'
,
'TrialRecord'
]
from
typing
import
Any
,
Dict
,
List
from
typing_extensions
import
Literal
,
TypedDict
Parameters
=
Dict
[
str
,
Any
]
"""
...
...
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