nni icon indicating copy to clipboard operation
nni copied to clipboard

How to get the best params of a model after the experiment stop

Open joshua-xia opened this issue 3 years ago • 2 comments

Describe the issue: I am try to use python code to read the best params of a model and then apply them to train the model. Now I hope the nni store the best params of a model in I defined file after the experiment finished or stopped so that I can read the params in it

Is there this feature?

Thanks!

Environment:

  • NNI version:
  • Training service (local|remote|pai|aml|etc):
  • Client OS:
  • Server OS (for remote mode only):
  • Python version:
  • PyTorch/TensorFlow version:
  • Is conda/virtualenv/venv used?:
  • Is running in Docker?:

Configuration:

  • Experiment config (remember to remove secrets!):
  • Search space:

Log message:

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

How to reproduce it?:

joshua-xia avatar Jul 19 '22 01:07 joshua-xia

I don't want search the best params from web UI or trial log manually, I wish there is a file store the best params in such as json format so that I can read it using python code and start to train my model automatically.

joshua-xia avatar Jul 19 '22 01:07 joshua-xia

Hey there, I have solved this issue by using the export_data method. First, you run the experiment with:

experiment.run(port=8000, wait_completion=True)

Then I fetch the results with:

experiment.export_data()

I believe the export_data method returns the results in JSON. If necessary, you may have stop the experiment to retrieve the results in your terminal:

experiment.stop()

Hope that helps!

MartinMashalov avatar Jul 19 '22 11:07 MartinMashalov

hi @joshua-xia Looks like this issue having a good solution to take it. Could you tell me what's your issue status? Can I close it? Expect your reply. Thanks.

Lijiaoa avatar Sep 16 '22 02:09 Lijiaoa