tvalentyn commented on code in PR #17514:
URL: https://github.com/apache/beam/pull/17514#discussion_r863680105
##########
sdks/python/apache_beam/ml/inference/pytorch.py:
##########
@@ -75,10 +75,13 @@ def __init__(
model_params: Dict[str, Any],
device: str = 'CPU'):
"""
- state_dict_path: path to the saved dictionary of the model state.
- model_class: class of the Pytorch model that defines the model structure.
- device: the device on which you wish to run the model. If ``device = GPU``
- then device will be cuda if it is available. Otherwise, it will be cpu.
+ Initializes a PytorchModelLoader
+ :param state_dict_path: path to the saved dictionary of the model state.
+ :param model_class: class of the Pytorch model that defines the model
+ structure.
+ :param device: the device on which you wish to run the model. If
+ ``device = GPU`` then device will be cuda if it is avaiable. Otherwise,
Review Comment:
```suggestion
``device = GPU`` then a GPU device will be used if it is available.
Otherwise,
```
##########
sdks/python/tox.ini:
##########
@@ -144,6 +144,7 @@ deps =
sphinx_rtd_theme==0.4.3
docutils<0.18
Jinja2==3.0.3 # TODO(BEAM-14172): Sphinx version is too old.
+ torch==1.9.0
Review Comment:
I don't think we should hardcode a particular version of torch, since Beam
doesn't have a requirement on torch.
##########
sdks/python/apache_beam/ml/inference/api.py:
##########
@@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# mypy: ignore-errors
Review Comment:
Why is this necessary now?
##########
sdks/python/apache_beam/ml/inference/pytorch.py:
##########
@@ -75,10 +75,13 @@ def __init__(
model_params: Dict[str, Any],
device: str = 'CPU'):
"""
- state_dict_path: path to the saved dictionary of the model state.
- model_class: class of the Pytorch model that defines the model structure.
- device: the device on which you wish to run the model. If ``device = GPU``
- then device will be cuda if it is available. Otherwise, it will be cpu.
+ Initializes a PytorchModelLoader
+ :param state_dict_path: path to the saved dictionary of the model state.
+ :param model_class: class of the Pytorch model that defines the model
+ structure.
+ :param device: the device on which you wish to run the model. If
+ ``device = GPU`` then device will be cuda if it is avaiable. Otherwise,
+ it will be cpu.
Review Comment:
```suggestion
it will be CPU.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]