"test/ut/vscode:/vscode.git/clone" did not exist on "d5a551c85d90f9f6890884d26402ebc40177a8bc"
Commit 41de58c5 authored by Zejun Lin's avatar Zejun Lin Committed by xuehui
Browse files

Fix bugs of NAS interface (#1131)

* fix bugs

* fix bug
parent 5a058baf
...@@ -90,7 +90,7 @@ NNI's annotation compiler transforms the annotated trial code to the code that c ...@@ -90,7 +90,7 @@ NNI's annotation compiler transforms the annotated trial code to the code that c
![](../img/nas_on_nni.png) ![](../img/nas_on_nni.png)
The above figure shows how the trial code runs on NNI. `nnictl` processes user trial code to generate a search space file and compiled trial code. The former is fed to tuner, and the latter is used to run trilas. The above figure shows how the trial code runs on NNI. `nnictl` processes user trial code to generate a search space file and compiled trial code. The former is fed to tuner, and the latter is used to run trials.
[__TODO__] Simple example of NAS on NNI. [__TODO__] Simple example of NAS on NNI.
......
...@@ -149,7 +149,7 @@ else: ...@@ -149,7 +149,7 @@ else:
chosen_layer = mutable_block[mutable_layer_id]["chosen_layer"] chosen_layer = mutable_block[mutable_layer_id]["chosen_layer"]
chosen_inputs = mutable_block[mutable_layer_id]["chosen_inputs"] chosen_inputs = mutable_block[mutable_layer_id]["chosen_inputs"]
real_chosen_inputs = [optional_inputs[input_name] for input_name in chosen_inputs] real_chosen_inputs = [optional_inputs[input_name] for input_name in chosen_inputs]
layer_out = funcs[chosen_layer]([fixed_inputs, real_chosen_inputs], *funcs_args[chosen_layer]) layer_out = funcs[chosen_layer]([fixed_inputs, real_chosen_inputs], **funcs_args[chosen_layer])
return layer_out return layer_out
......
...@@ -60,7 +60,7 @@ def parse_annotation_mutable_layers(code, lineno): ...@@ -60,7 +60,7 @@ def parse_annotation_mutable_layers(code, lineno):
kw_args = [] kw_args = []
kw_values = [] kw_values = []
for kw in call.keywords: for kw in call.keywords:
kw_args.append(kw.arg) kw_args.append(ast.Str(s=kw.arg))
kw_values.append(kw.value) kw_values.append(kw.value)
call_kwargs_values.append(ast.Dict(keys=kw_args, values=kw_values)) call_kwargs_values.append(ast.Dict(keys=kw_args, values=kw_values))
call_funcs = ast.Dict(keys=call_funcs_keys, values=call_funcs_values) call_funcs = ast.Dict(keys=call_funcs_keys, values=call_funcs_values)
...@@ -314,20 +314,20 @@ class Transformer(ast.NodeTransformer): ...@@ -314,20 +314,20 @@ class Transformer(ast.NodeTransformer):
else: else:
return node # not an annotation, ignore it return node # not an annotation, ignore it
if string.startswith('@nni.get_next_parameter('): if string.startswith('@nni.get_next_parameter'):
deprecated_message = "'@nni.get_next_parameter' is deprecated in annotation due to inconvenience. Please remove this line in the trial code." deprecated_message = "'@nni.get_next_parameter' is deprecated in annotation due to inconvenience. Please remove this line in the trial code."
print_warning(deprecated_message) print_warning(deprecated_message)
if string.startswith('@nni.report_intermediate_result(') \ if string.startswith('@nni.report_intermediate_result') \
or string.startswith('@nni.report_final_result(') \ or string.startswith('@nni.report_final_result') \
or string.startswith('@nni.get_next_parameter('): or string.startswith('@nni.get_next_parameter'):
return parse_annotation(string[1:]) # expand annotation string to code return parse_annotation(string[1:]) # expand annotation string to code
if string.startswith('@nni.mutable_layers('): if string.startswith('@nni.mutable_layers'):
return parse_annotation_mutable_layers(string[1:], node.lineno) return parse_annotation_mutable_layers(string[1:], node.lineno)
if string.startswith('@nni.variable(') \ if string.startswith('@nni.variable') \
or string.startswith('@nni.function_choice('): or string.startswith('@nni.function_choice'):
self.stack[-1] = string[1:] # mark that the next expression is annotated self.stack[-1] = string[1:] # mark that the next expression is annotated
return None return None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment