Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tools/Polygraphy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Dates are in YYYY-MM-DD format.

### Fixed
- Fixed issue when `polygraphy multi-device shard` would exceed python recursive depth limit on large models.
- Fixed a bug where setting `POLYGRAPHY_ASK_BEFORE_INSTALL=0` would enable asking before installing dependencies instead of disabling it.


## v0.49.26 (2025-07-16)
Expand Down
2 changes: 1 addition & 1 deletion tools/Polygraphy/polygraphy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
This can be configured by setting the 'POLYGRAPHY_AUTOINSTALL_DEPS' environment variable.
"""

ASK_BEFORE_INSTALL = bool(os.environ.get("POLYGRAPHY_ASK_BEFORE_INSTALL", "0" != "0"))
ASK_BEFORE_INSTALL = bool(os.environ.get("POLYGRAPHY_ASK_BEFORE_INSTALL", "0") != "0")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually already fixed internally and would go out with the next release, but thanks for fixing it here!

"""
bool: Whether Polygraphy should ask before automatically installing required Python packages.
Has no effect if AUTOINSTALL_DEPS is not enabled.
Expand Down
44 changes: 44 additions & 0 deletions tools/Polygraphy/tests/test_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# SPDX-FileCopyrightText: Copyright (c) 1993-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import importlib
import os

from polygraphy import config


class TestConfigEnvVars:
def test_ask_before_install(self):
key = "POLYGRAPHY_ASK_BEFORE_INSTALL"
prev = os.environ.pop(key, None)
try:
importlib.reload(config)
assert not config.ASK_BEFORE_INSTALL

os.environ[key] = "0"
importlib.reload(config)
assert not config.ASK_BEFORE_INSTALL

os.environ[key] = "1"
importlib.reload(config)
assert config.ASK_BEFORE_INSTALL
finally:
if prev is not None:
os.environ[key] = prev
else:
os.environ.pop(key, None)
importlib.reload(config)
Loading