From 78b6b1bfaa00d3e2748406df24e1a3e42de8dcaf Mon Sep 17 00:00:00 2001 From: Dong Hyuk Chang Date: Fri, 27 Sep 2024 07:06:27 -0700 Subject: [PATCH] Require setuptools>=70 and update deprecated api Signed-off-by: Dong Hyuk Chang --- examples/nlp/language_modeling/megatron_gpt_distillation.py | 2 +- .../multimodal/models/multimodal_llm/neva/neva_model.py | 2 +- .../megatron/gpt_full_te_layer_autocast_spec.py | 2 +- nemo/collections/nlp/modules/common/megatron/attention.py | 3 +-- requirements/requirements.txt | 2 +- tests/collections/nlp/test_flash_attention.py | 1 - 6 files changed, 5 insertions(+), 7 deletions(-) diff --git a/examples/nlp/language_modeling/megatron_gpt_distillation.py b/examples/nlp/language_modeling/megatron_gpt_distillation.py index b3ecdcfc5522..64b6f51e4658 100644 --- a/examples/nlp/language_modeling/megatron_gpt_distillation.py +++ b/examples/nlp/language_modeling/megatron_gpt_distillation.py @@ -38,7 +38,7 @@ from megatron.core.dist_checkpointing.mapping import ShardedStateDict from megatron.core.parallel_state import get_tensor_model_parallel_group from megatron.core.transformer import TransformerConfig -from pkg_resources import packaging +import packaging from torch import Tensor from torch.nn.modules.loss import _Loss diff --git a/nemo/collections/multimodal/models/multimodal_llm/neva/neva_model.py b/nemo/collections/multimodal/models/multimodal_llm/neva/neva_model.py index 07bc4f3960d3..d9a7234f3c64 100644 --- a/nemo/collections/multimodal/models/multimodal_llm/neva/neva_model.py +++ b/nemo/collections/multimodal/models/multimodal_llm/neva/neva_model.py @@ -22,7 +22,7 @@ import torch.nn.functional as F from einops import rearrange, reduce, repeat from omegaconf import DictConfig, ListConfig, OmegaConf -from pkg_resources import packaging +import packaging from pytorch_lightning.trainer.trainer import Trainer from transformers import CLIPVisionModel, SiglipVisionModel diff --git a/nemo/collections/nlp/models/language_modeling/megatron/gpt_full_te_layer_autocast_spec.py b/nemo/collections/nlp/models/language_modeling/megatron/gpt_full_te_layer_autocast_spec.py index b04ff248a326..f0510ad0be97 100644 --- a/nemo/collections/nlp/models/language_modeling/megatron/gpt_full_te_layer_autocast_spec.py +++ b/nemo/collections/nlp/models/language_modeling/megatron/gpt_full_te_layer_autocast_spec.py @@ -16,7 +16,7 @@ from typing import Any, Callable, Optional import torch -from pkg_resources import packaging +import packaging from nemo.collections.nlp.modules.common.megatron.utils import ApexGuardDefaults from nemo.collections.nlp.parts import utils_funcs diff --git a/nemo/collections/nlp/modules/common/megatron/attention.py b/nemo/collections/nlp/modules/common/megatron/attention.py index a52607c01b7d..4833d4e8a972 100644 --- a/nemo/collections/nlp/modules/common/megatron/attention.py +++ b/nemo/collections/nlp/modules/common/megatron/attention.py @@ -67,10 +67,9 @@ try: # Flash Attention Triton - import pkg_resources from flash_attn.flash_attn_triton import flash_attn_func as flash_attn_func_triton -except (ImportError, ModuleNotFoundError, pkg_resources.DistributionNotFound): +except (ImportError, ModuleNotFoundError): flash_attn_func_triton = None diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 0bd6208f11c7..eda898ea233f 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -5,7 +5,7 @@ onnx>=1.7.0 python-dateutil ruamel.yaml scikit-learn -setuptools>=65.5.1 +setuptools>=70.0.0 tensorboard text-unidecode torch diff --git a/tests/collections/nlp/test_flash_attention.py b/tests/collections/nlp/test_flash_attention.py index 4bd740011b24..1453ab5220bb 100644 --- a/tests/collections/nlp/test_flash_attention.py +++ b/tests/collections/nlp/test_flash_attention.py @@ -39,7 +39,6 @@ HAVE_FA = False try: - import pkg_resources import triton HAVE_TRITON = True