Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

fix annotation key-error #806

Merged
merged 4 commits into from
Mar 7, 2019

Conversation

Crysple
Copy link
Contributor

@Crysple Crysple commented Mar 4, 2019

Overview

Related to #801

When use annotation in a file in a sub-directory and import it from the main program, there's a search space key inconsistency between search space generator and NNI sdk. The latter one use inspect library to get module name in a wrong way (without importing path)

Background

Note that NNI's annotation variable consists of three parts like:
key = '{}/{}/{}'.format(module, name, function_type)
where the first one is the module path of the file that uses annotation, the second one is the annotated variable name given by user, and the third one is the search space type like choice or uniform. Below we only consider the module part of its key.

Comparison

For example, if the main program is main.py and users use annotation in subpkg_main.py, their key is:

  • NNI API:
    • Before fix: subpkg_main
    • After fix: subpkg.subpkg_main
  • Search Space Generator:
    • Before fix: subpkg.subpkg_main
    • After fix: subpkg.subpkg_main
├── main.py
└── subpkg
    ├── __init__.py
    └──  subpkg_main.py

@QuanluZhang
Copy link
Contributor

@Crysple let's rethink the construction of the key.

@QuanluZhang
Copy link
Contributor

looks good

@Crysple
Copy link
Contributor Author

Crysple commented Mar 7, 2019

Waive for further unit test modification

@QuanluZhang QuanluZhang merged commit 7108466 into microsoft:master Mar 7, 2019
SparkSnail added a commit to SparkSnail/nni that referenced this pull request Mar 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants