From 08ab1abff423b323cb409d12226616170592ea3c Mon Sep 17 00:00:00 2001 From: Ben Schneider <82730624+Ben-Schneider-code@users.noreply.github.com> Date: Thu, 13 Feb 2025 04:55:49 -0500 Subject: [PATCH] Add reminder config to issue template and print DS version in env (#35156) * update env command to log deepspeed version * suppress deepspeed import logging * Add reminder to include configs to repro description in bug report. * make fixup * [WIP] update import utils for deepspeed * Change to using is_deepspeed_available() from integrations. * make fixup --- .github/ISSUE_TEMPLATE/bug-report.yml | 1 + src/transformers/commands/env.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index ecc795ae63..9b2c00bac5 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -106,6 +106,7 @@ body: label: Reproduction description: | Please provide a code sample that reproduces the problem you ran into. It can be a Colab link or just a code snippet. + Please include relevant config information with your code, for example your Trainers, TRL, Peft, and DeepSpeed configs. If you have code snippets, error messages, stack traces please provide them here as well. Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code. diff --git a/src/transformers/commands/env.py b/src/transformers/commands/env.py index 80d8b05e04..855bbc961b 100644 --- a/src/transformers/commands/env.py +++ b/src/transformers/commands/env.py @@ -12,7 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. + +import contextlib import importlib.util +import io import os import platform from argparse import ArgumentParser @@ -20,6 +23,7 @@ from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version +from ..integrations.deepspeed import is_deepspeed_available from ..utils import ( is_accelerate_available, is_flax_available, @@ -104,6 +108,13 @@ class EnvironmentCommand(BaseTransformersCLICommand): # returns list of devices, convert to bool tf_cuda_available = bool(tf.config.list_physical_devices("GPU")) + deepspeed_version = "not installed" + if is_deepspeed_available(): + # Redirect command line output to silence deepspeed import output. + with contextlib.redirect_stdout(io.StringIO()): + import deepspeed + deepspeed_version = deepspeed.__version__ + flax_version = "not installed" jax_version = "not installed" jaxlib_version = "not installed" @@ -126,6 +137,7 @@ class EnvironmentCommand(BaseTransformersCLICommand): "Safetensors version": f"{safetensors_version}", "Accelerate version": f"{accelerate_version}", "Accelerate config": f"{accelerate_config_str}", + "DeepSpeed version": f"{deepspeed_version}", "PyTorch version (GPU?)": f"{pt_version} ({pt_cuda_available})", "Tensorflow version (GPU?)": f"{tf_version} ({tf_cuda_available})", "Flax version (CPU?/GPU?/TPU?)": f"{flax_version} ({jax_backend})",