MONAI icon indicating copy to clipboard operation
MONAI copied to clipboard

DeprecationWarning when import monai

Open KumoLiu opened this issue 1 year ago • 4 comments

/usr/local/lib/python3.10/dist-packages/ignite/handlers/checkpoint.py:16: DeprecationWarning: `TorchScript` support for functional optimizers is deprecated and will be removed in a future PyTorch release. Consider using the `torch.compile` optimizer instead.
  from torch.distributed.optim import ZeroRedundancyOptimizer
/usr/local/lib/python3.10/dist-packages/modelopt/torch/quantization/tensor_quant.py:92: FutureWarning: `torch.library.impl_abstract` was renamed to `torch.library.register_fake`. Please use that instead; we will remove `torch.library.impl_abstract` in a future version of PyTorch.
  scaled_e4m3_abstract = torch.library.impl_abstract("trt::quantize_fp8")(
WARNING:py.warnings:`np.bool8` is a deprecated alias for `np.bool_`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.object0` is a deprecated alias for ``np.object0` is a deprecated alias for `np.object_`. `object` can be used instead.  (Deprecated NumPy 1.24)`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.int0` is a deprecated alias for `np.intp`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.uint0` is a deprecated alias for `np.uintp`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.void0` is a deprecated alias for `np.void`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.bytes0` is a deprecated alias for `np.bytes_`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:`np.str0` is a deprecated alias for `np.str_`.  (Deprecated NumPy 1.24)

WARNING:py.warnings:Implicitly cleaning up <TemporaryDirectory '/tmp/tmpwhzwfrqi'>

KumoLiu avatar Sep 02 '24 08:09 KumoLiu

Some new warning:

WARNING:py.warnings:pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

WARNING:py.warnings:Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/

WARNING:py.warnings:Pydantic V1 style `@root_validator` validators are deprecated. You should migrate to Pydantic V2 style `@model_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/

WARNING:py.warnings:Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/

WARNING:torch_tensorrt.dynamo.conversion.aten_ops_converters:Unable to import quantization op. Please install modelopt library (https://github.com/NVIDIA/TensorRT-Model-Optimizer?tab=readme-ov-file#installation) to add support for compiling quantized models

WARNING:py.warnings:Implicitly cleaning up <TemporaryDirectory '/tmp/tmpi_trmfs_'>

KumoLiu avatar Sep 04 '24 16:09 KumoLiu

Hi @KumoLiu are these still current warnings that we need to look at? I think the Numpy related ones are obsolete now.

ericspod avatar Mar 31 '25 22:03 ericspod

Hi @ericspod, in this PR I've suppressed these warnings, so it should be fine for now. Since these warnings are not originating from the MONAI core itself, let's keep the suppression as it is for now. What do you think? We can close this ticket or leave it as a reminder. Both should be fine to me. https://github.com/Project-MONAI/MONAI/blob/4986d7ffd2d351c9d66de0e0329884b1a26d5500/monai/init.py#L54

KumoLiu avatar Apr 01 '25 03:04 KumoLiu

I think we leave things as they are with the warnings suppressed and we will revisit this later.

ericspod avatar Apr 09 '25 12:04 ericspod