leandron commented on a change in pull request #9074:
URL: https://github.com/apache/tvm/pull/9074#discussion_r714110303
##########
File path: tests/python/driver/tvmc/test_frontends.py
##########
@@ -211,3 +212,43 @@ def
test_load_model___wrong_language__to_pytorch(tflite_mobilenet_v1_1_quant):
model_format="pytorch",
shape_dict={"input": [1, 3, 224, 224]},
)
+
+
[email protected]("tvm.driver.tvmc.frontends.import_keras")
+def test_import_keras_friendly_message(import_keras_mock, keras_resnet50):
+ import_keras_mock.side_effect = TVMCException("keras is not installed")
+
+ with pytest.raises(TVMCException) as e:
+ _ = tvmc.frontends.load_model(keras_resnet50, model_format="keras")
+
+
[email protected]("tvm.driver.tvmc.frontends.import_onnx")
+def test_import_onnx_friendly_message(import_onnx_mock, onnx_resnet50):
Review comment:
```suggestion
def test_import_onnx_friendly_message(import_onnx_mock, onnx_resnet50):
# some CI environments wont offer onnx, so skip in case it is not present
pytest.importorskip("onnx")
```
##########
File path: tests/python/driver/tvmc/test_frontends.py
##########
@@ -211,3 +212,43 @@ def
test_load_model___wrong_language__to_pytorch(tflite_mobilenet_v1_1_quant):
model_format="pytorch",
shape_dict={"input": [1, 3, 224, 224]},
)
+
+
[email protected]("tvm.driver.tvmc.frontends.import_keras")
+def test_import_keras_friendly_message(import_keras_mock, keras_resnet50):
+ import_keras_mock.side_effect = TVMCException("keras is not installed")
+
+ with pytest.raises(TVMCException) as e:
+ _ = tvmc.frontends.load_model(keras_resnet50, model_format="keras")
+
+
[email protected]("tvm.driver.tvmc.frontends.import_onnx")
+def test_import_onnx_friendly_message(import_onnx_mock, onnx_resnet50):
+ import_onnx_mock.side_effect = TVMCException("onnx is not installed")
+
+ with pytest.raises(TVMCException) as e:
+ _ = tvmc.frontends.load_model(onnx_resnet50, model_format="onnx")
+
+
[email protected]("tvm.driver.tvmc.frontends.import_tensorflow")
+def test_import_tensorflow_friendly_message(import_tensorflow_mock,
pb_mobilenet_v1_1_quant):
+ import_tensorflow_mock.side_effect = TVMCException("tensorflow is not
installed")
+
+ with pytest.raises(TVMCException) as e:
+ _ = tvmc.frontends.load_model(pb_mobilenet_v1_1_quant,
model_format="pb")
+
+
[email protected]("tvm.driver.tvmc.frontends.import_torch")
+def test_import_torch_friendly_message(import_torch_mock, pytorch_resnet18):
Review comment:
```suggestion
def test_import_torch_friendly_message(import_torch_mock, pytorch_resnet18):
# some CI environments wont offer pytorch, so skip in case it is not
present
pytest.importorskip("torch")
```
##########
File path: tests/python/driver/tvmc/test_frontends.py
##########
@@ -211,3 +212,43 @@ def
test_load_model___wrong_language__to_pytorch(tflite_mobilenet_v1_1_quant):
model_format="pytorch",
shape_dict={"input": [1, 3, 224, 224]},
)
+
+
[email protected]("tvm.driver.tvmc.frontends.import_keras")
+def test_import_keras_friendly_message(import_keras_mock, keras_resnet50):
+ import_keras_mock.side_effect = TVMCException("keras is not installed")
+
+ with pytest.raises(TVMCException) as e:
+ _ = tvmc.frontends.load_model(keras_resnet50, model_format="keras")
+
+
[email protected]("tvm.driver.tvmc.frontends.import_onnx")
+def test_import_onnx_friendly_message(import_onnx_mock, onnx_resnet50):
+ import_onnx_mock.side_effect = TVMCException("onnx is not installed")
+
+ with pytest.raises(TVMCException) as e:
+ _ = tvmc.frontends.load_model(onnx_resnet50, model_format="onnx")
+
+
[email protected]("tvm.driver.tvmc.frontends.import_tensorflow")
+def test_import_tensorflow_friendly_message(import_tensorflow_mock,
pb_mobilenet_v1_1_quant):
+ import_tensorflow_mock.side_effect = TVMCException("tensorflow is not
installed")
+
+ with pytest.raises(TVMCException) as e:
+ _ = tvmc.frontends.load_model(pb_mobilenet_v1_1_quant,
model_format="pb")
+
+
[email protected]("tvm.driver.tvmc.frontends.import_torch")
+def test_import_torch_friendly_message(import_torch_mock, pytorch_resnet18):
+ import_torch_mock.side_effect = TVMCException("torch is not installed")
+
+ with pytest.raises(TVMCException) as e:
+ _ = tvmc.frontends.load_model(pytorch_resnet18, model_format="pytorch")
+
+
[email protected]("tvm.driver.tvmc.frontends.import_tflite")
+def test_import_tflite_friendly_message(import_tflite_mock,
tflite_mobilenet_v1_1_quant):
Review comment:
```suggestion
def test_import_tflite_friendly_message(import_tflite_mock,
tflite_mobilenet_v1_1_quant):
# some CI environments wont offer TFLite, so skip in case it is not
present
pytest.importorskip("tflite")
```
##########
File path: tests/python/driver/tvmc/test_frontends.py
##########
@@ -211,3 +212,43 @@ def
test_load_model___wrong_language__to_pytorch(tflite_mobilenet_v1_1_quant):
model_format="pytorch",
shape_dict={"input": [1, 3, 224, 224]},
)
+
+
[email protected]("tvm.driver.tvmc.frontends.import_keras")
+def test_import_keras_friendly_message(import_keras_mock, keras_resnet50):
+ import_keras_mock.side_effect = TVMCException("keras is not installed")
+
+ with pytest.raises(TVMCException) as e:
+ _ = tvmc.frontends.load_model(keras_resnet50, model_format="keras")
+
+
[email protected]("tvm.driver.tvmc.frontends.import_onnx")
+def test_import_onnx_friendly_message(import_onnx_mock, onnx_resnet50):
+ import_onnx_mock.side_effect = TVMCException("onnx is not installed")
+
+ with pytest.raises(TVMCException) as e:
+ _ = tvmc.frontends.load_model(onnx_resnet50, model_format="onnx")
+
+
[email protected]("tvm.driver.tvmc.frontends.import_tensorflow")
+def test_import_tensorflow_friendly_message(import_tensorflow_mock,
pb_mobilenet_v1_1_quant):
Review comment:
```suggestion
def test_import_tensorflow_friendly_message(import_tensorflow_mock,
pb_mobilenet_v1_1_quant):
# some CI environments wont offer tensorflow, so skip in case it is not
present
pytest.importorskip("tensorflow")
```
##########
File path: tests/python/driver/tvmc/test_frontends.py
##########
@@ -211,3 +212,43 @@ def
test_load_model___wrong_language__to_pytorch(tflite_mobilenet_v1_1_quant):
model_format="pytorch",
shape_dict={"input": [1, 3, 224, 224]},
)
+
+
[email protected]("tvm.driver.tvmc.frontends.import_keras")
+def test_import_keras_friendly_message(import_keras_mock, keras_resnet50):
Review comment:
```suggestion
def test_import_keras_friendly_message(import_keras_mock, keras_resnet50):
# some CI environments wont offer keras, so skip in case it is not
present
pytest.importorskip("keras")
```
--
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]