sooftware / conformer

[Unofficial] PyTorch implementation of "Conformer: Convolution-augmented Transformer for Speech Recognition" (INTERSPEECH 2020)
Apache License 2.0
958 stars 175 forks source link

Switching device #33

Closed enhuiz closed 3 years ago

enhuiz commented 3 years ago

Hi. I notice the model requires passing the device as an argument, which may have not been decided yet at the point of the module initialization. Once the device is decided, it seems we cannot easily change it. Do you consider making the device switchable? One solution may be instead of passing the device, add an attribute:

@property
def device(self):
    return next(self.parameters()).device
sooftware commented 3 years ago

Thank you. Can you send me a pull request?