From 613459c2b857afc56b8983006f8bbb429c096924 Mon Sep 17 00:00:00 2001 From: Qubitium Date: Tue, 14 Oct 2025 08:08:28 +0000 Subject: [PATCH] fix missing git add Signed-off-by: Qubitium --- gptqmodel/utils/env.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 gptqmodel/utils/env.py diff --git a/gptqmodel/utils/env.py b/gptqmodel/utils/env.py new file mode 100644 index 000000000..2b1e85535 --- /dev/null +++ b/gptqmodel/utils/env.py @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: 2024-2025 ModelCloud.ai +# SPDX-FileCopyrightText: 2024-2025 qubitium@modelcloud.ai +# SPDX-License-Identifier: Apache-2.0 +# Contact: qubitium@modelcloud.ai, x.com/qubitium + +"""Environment variable helpers used across GPTQModel.""" + +from __future__ import annotations + +import os + +_TRUTHY = {"1", "true", "yes", "on", "y"} + + +def env_flag(name: str, default: str | None = "0") -> bool: + """Return ``True`` when an env var is set to a truthy value.""" + + value = os.getenv(name, default) + if value is None: + return False + return value.strip().lower() in _TRUTHY + + +__all__ = ["env_flag"]