Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: ExperimentConfig: type of experiment_name (None) is not typing.Optional[str] #5468

Closed
hayatejp opened this issue Mar 21, 2023 · 4 comments
Assignees

Comments

@hayatejp
Copy link

hayatejp commented Mar 21, 2023

Describe the issue:
Hello,Following the document and guide of NNI in a new computer, I tried to start the HPO Quickstart with Pytorch Document Link,I followed the steps and then at the step of "experiment.run(8080)",it occured the error"ValueErr

or: ExperimentConfig: type of experiment_name (None) is not typing.Optional[str]"
The full error output is as followed:
20230321221536

I have tried it in varites of running envrionment but the error occured as well.So I am not sure that there is some essential step that not mentioned in the doc , or some issues of NNI.

I also tried the method with nnictl Document Link,When I used the demand " nnictl create --config config.yml --port 8080"(Both for my config files and the nni example config),it could occur the error that :

20230321224701

Even I tried the other trial project or the command "nnictl hello",these also happened.But the command like "nnictl --version" runs normally.

Environment:

  • NNI version:2.10(I also tried the old Version such as 2.7,2.9)
  • Training service (local|remote|pai|aml|etc):Local
  • Client OS:Windows 10(native mode and WSL2 of Ubuntu)
  • Server OS (for remote mode only):None
  • Python version:3.9(I also tried in 3.7,which also occured)
  • PyTorch/TensorFlow version:1.13
  • Is conda/virtualenv/venv used?:Yes,Conda
  • Is running in Docker?:No

Configuration:

  • Experiment config (remember to remove secrets!):
    from nni.experiment import Experiment
    experiment = Experiment('local')

search_space = {
#'features': {'_type': 'choice', '_value': [128, 256, 512, 1024]},
'lr': {'_type': 'loguniform', '_value': [1e-4, 1e-3]},
#'momentum': {'_type': 'uniform', '_value': [0, 1]},
'num_epochs': {'_type': 'choice', '_value': [3, 4, 5]},
'eps': {'_type': 'uniform', '_value': [1e-8, 1e-7]},

}

experiment.config.trial_command = 'python model.py'
experiment.config.trial_code_directory = '.'
experiment.config.tuner.name = 'TPE'
experiment.config.tuner.class_args['optimize_mode'] = 'maximize'
experiment.config.max_trial_number = 10
experiment.config.trial_concurrency = 2
max_experiment_duration = '1h'
experiment.run(8080)

  • Search space:Mentioned above

Log message:

  • nnimanager.log:
  • dispatcher.log:
  • nnictl stdout and stderr:

How to reproduce it?:
Following the two Documents mentions above in the new computer, then these would be reproduced.

@beta1scat
Copy link

beta1scat commented Mar 22, 2023

Hello, pip install "typeguard<3" may solve this problem.
Reference: #5457

@liuzhe-lz liuzhe-lz self-assigned this Mar 22, 2023
@hayatejp
Copy link
Author

Thank you beta1scat,It works

@ChuckieLiang
Copy link

I met this error, too. Why does this happen?
(lsqDL) PS D:\VSCode\Liang2023\TEST0> & C:/Users/dell/.conda/envs/lsqDL/python.exe d:/VSCode/Liang2023/TEST0/main.py Traceback (most recent call last): File "d:\VSCode\Liang2023\TEST0\main.py", line 128, in <module> experiment.run(8080) File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\experiment.py", line 180, in run self.start(port, debug) File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\experiment.py", line 135, in start self._start_impl(port, debug, run_mode, None, []) File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\experiment.py", line 94, in _start_impl config = self.config.canonical_copy() File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\config\base.py", line 167, in canonical_copy canon._validate_canonical() File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\config\experiment_config.py", line 155, in _validate_canonical super()._validate_canonical() File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\config\base.py", line 237, in _validate_canonical utils.validate_type(self) File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\config\utils\internal.py", line 106, in validate_type raise ValueError(f'{class_name}: type of {field.name} ({repr(value)}) is not {field.type}') ValueError: ExperimentConfig: type of experiment_name (None) is not typing.Optional[str]

@hayatejp
Copy link
Author

I met this error, too. Why does this happen? (lsqDL) PS D:\VSCode\Liang2023\TEST0> & C:/Users/dell/.conda/envs/lsqDL/python.exe d:/VSCode/Liang2023/TEST0/main.py Traceback (most recent call last): File "d:\VSCode\Liang2023\TEST0\main.py", line 128, in <module> experiment.run(8080) File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\experiment.py", line 180, in run self.start(port, debug) File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\experiment.py", line 135, in start self._start_impl(port, debug, run_mode, None, []) File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\experiment.py", line 94, in _start_impl config = self.config.canonical_copy() File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\config\base.py", line 167, in canonical_copy canon._validate_canonical() File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\config\experiment_config.py", line 155, in _validate_canonical super()._validate_canonical() File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\config\base.py", line 237, in _validate_canonical utils.validate_type(self) File "C:\Users\dell\.conda\envs\lsqDL\lib\site-packages\nni\experiment\config\utils\internal.py", line 106, in validate_type raise ValueError(f'{class_name}: type of {field.name} ({repr(value)}) is not {field.type}') ValueError: ExperimentConfig: type of experiment_name (None) is not typing.Optional[str]

Hello,you can try "pip install typeguard==2.13"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants