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

RuntimeError: tensor op type aten::view has more than one matched: [[('size', 'List[int]', 'None')], [('dtype', 'int', 'None')]] #3928

Closed
sayakpaul opened this issue Jul 12, 2021 · 6 comments
Assignees

Comments

@sayakpaul
Copy link

Describe the issue:

RuntimeError: tensor op type aten::view has more than one matched: [[('size', 'List[int]', 'None')], [('dtype', 'int', 'None')]]

Environment: Google Colab

Configuration:

I am referring to this example.

Log message:

/usr/local/lib/python3.7/dist-packages/nni/retiarii/experiment/pytorch.py in run(self, config, port, debug)
    255             assert config is not None, 'You are using classic search mode, config cannot be None!'
    256             self.config = config
--> 257             self.start(port, debug)
    258 
    259     def _check_exp_status(self) -> bool:

/usr/local/lib/python3.7/dist-packages/nni/retiarii/experiment/pytorch.py in start(self, port, debug)
    237         exp_status_checker = Thread(target=self._check_exp_status)
    238         exp_status_checker.start()
--> 239         self._start_strategy()
    240         # TODO: the experiment should be completed, when strategy exits and there is no running job
    241         _logger.info('Waiting for experiment to become DONE (you can ctrl+c if there is no running trial jobs)...')

/usr/local/lib/python3.7/dist-packages/nni/retiarii/experiment/pytorch.py in _start_strategy(self)
    175 
    176         _logger.info('Start strategy...')
--> 177         self.strategy.run(base_model_ir, self.applied_mutators)
    178         _logger.info('Strategy exit')
    179         # TODO: find out a proper way to show no more trial message on WebUI

/usr/local/lib/python3.7/dist-packages/nni/retiarii/strategy/tpe_strategy.py in run(self, base_model, applied_mutators)
     77                     model = mutator.apply(model)
     78                 # run models
---> 79                 submit_models(model)
     80                 self.running_models[self.model_id] = model
     81                 self.model_id += 1

/usr/local/lib/python3.7/dist-packages/nni/retiarii/execution/api.py in submit_models(*models)
     42     engine = get_execution_engine()
     43     get_and_register_default_listener(engine)
---> 44     engine.submit_models(*models)
     45 
     46 

/usr/local/lib/python3.7/dist-packages/nni/retiarii/execution/base.py in submit_models(self, *models)
     60     def submit_models(self, *models: Model) -> None:
     61         for model in models:
---> 62             data = self.pack_model_data(model)
     63             self._running_models[send_trial(data.dump())] = model
     64             self._history.append(model)

/usr/local/lib/python3.7/dist-packages/nni/retiarii/execution/base.py in pack_model_data(cls, model)
    111     @classmethod
    112     def pack_model_data(cls, model: Model) -> Any:
--> 113         return BaseGraphData(codegen.model_to_pytorch_script(model), model.evaluator)
    114 
    115     @classmethod

/usr/local/lib/python3.7/dist-packages/nni/retiarii/codegen/pytorch.py in model_to_pytorch_script(model, placement)
     14     total_pkgs = set()
     15     for name, cell in model.graphs.items():
---> 16         import_pkgs, graph_code = graph_to_pytorch_model(name, cell, placement=placement)
     17         graphs.append(graph_code)
     18         total_pkgs.update(import_pkgs)

/usr/local/lib/python3.7/dist-packages/nni/retiarii/codegen/pytorch.py in graph_to_pytorch_model(graph_name, graph, placement)
    137             if node.operation.type == 'shared':
    138                 submodule_name = _remove_prefix(node.operation.parameters['reference'], graph_name)
--> 139             edge_codes.append(node.operation.to_forward_code(submodule_name, node_name, inputs, inputs_value))
    140 
    141     output_names, _ = _format_inputs(graph.output_node)

/usr/local/lib/python3.7/dist-packages/nni/retiarii/operation_def/torch_op_def.py in to_forward_code(self, field, output, inputs, inputs_value)
    371         if self.type in TensorOps.comparison_ops:
    372             return f'{output} = ({inputs[0]} {TensorOps.comparison_ops[self.type]} {inputs[1]})'
--> 373         matched_args = TensorOps._get_matched_args(self.type, inputs)
    374         if matched_args is None:
    375             return TensorOpExceptions[self.type](output, inputs)

/usr/local/lib/python3.7/dist-packages/nni/retiarii/operation_def/torch_op_def.py in _get_matched_args(_type, inputs)
    361                 return ManuallyChooseDef[_type]
    362             else:
--> 363                 raise RuntimeError(f'tensor op type {_type} has more than one matched: {matched}')
    364         else:
    365             if _type in TensorOpExceptions:

RuntimeError: tensor op type aten::view has more than one matched: [[('size', 'List[int]', 'None')], [('dtype', 'int', 'None')]]

How to reproduce it?: Here's the Colab Notebook.

@QuanluZhang QuanluZhang self-assigned this Jul 14, 2021
@QuanluZhang
Copy link
Contributor

@sayakpaul , in v2.3 retiarii only supports torch 1.6 and 1.7.

torch 1.8 and 1.9 will be supported in NNI v2.4 which will be released soon. you can checkout this pr #3937

@sayakpaul
Copy link
Author

Let me run the notebook by checking out the branch first.

@sayakpaul
Copy link
Author

sayakpaul commented Jul 14, 2021

@QuanluZhang could you tell me how I should install nni from your branch so that it's compatible with Torch 1.9?

@QuanluZhang
Copy link
Contributor

@sayakpaul you can install from source, please refer to this doc https://nni.readthedocs.io/en/stable/Tutorial/InstallationLinux.html#install-nni-through-source-code

@sayakpaul
Copy link
Author

@QuanluZhang was able to finally nni (built from source). Here's the Colab Notebook in case anyone else faces a similar problem can get a workaround.

@sayakpaul
Copy link
Author

@QuanluZhang on a single Tesla P100, how long do you think the example should take to complete? Having some timing information would be really helpful.

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

No branches or pull requests

2 participants