From f10c5c04a693aabf8dd7f5975331eb93015ca661 Mon Sep 17 00:00:00 2001 From: lonexreb Date: Fri, 10 Jul 2026 12:12:31 -0500 Subject: [PATCH 1/2] [None][fix] namespace cnn_dailymail calibration dataset id The bare 'cnn_dailymail' repo id was relocated to 'abisee/cnn_dailymail'; newer huggingface_hub rejects un-namespaced ids, so load_calib_dataset failed with HfUriError. Rewrite the bare id before load_dataset. Revives closed PR #16124 (issue #15802). Signed-off-by: lonexreb --- tensorrt_llm/models/convert_utils.py | 5 +++ .../others/test_calib_dataset_namespace.py | 38 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 tests/unittest/others/test_calib_dataset_namespace.py diff --git a/tensorrt_llm/models/convert_utils.py b/tensorrt_llm/models/convert_utils.py index 58da3ec36349..f75234da444c 100644 --- a/tensorrt_llm/models/convert_utils.py +++ b/tensorrt_llm/models/convert_utils.py @@ -317,6 +317,11 @@ def load_calib_dataset(dataset_name_or_dir: str, key = meta[2] break + # The bare "cnn_dailymail" repo id was relocated to "abisee/cnn_dailymail"; + # newer huggingface_hub rejects un-namespaced ids. + if dataset_name_or_dir == "cnn_dailymail": + dataset_name_or_dir = "abisee/cnn_dailymail" + dataset = load_dataset(dataset_name_or_dir, name=config_name, split=split, diff --git a/tests/unittest/others/test_calib_dataset_namespace.py b/tests/unittest/others/test_calib_dataset_namespace.py new file mode 100644 index 000000000000..c931d72b1111 --- /dev/null +++ b/tests/unittest/others/test_calib_dataset_namespace.py @@ -0,0 +1,38 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 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. +from unittest import mock + +import tensorrt_llm.models.convert_utils as convert_utils +from tensorrt_llm.models.convert_utils import load_calib_dataset + + +def test_bare_cnn_dailymail_is_namespaced() -> None: + # Newer huggingface_hub rejects the bare "cnn_dailymail" repo id; it must + # be rewritten to the relocated "abisee/cnn_dailymail" (issue #15802/#16124). + with mock.patch.object( + convert_utils, "load_dataset", return_value={"article": ["x"]} + ) as load_dataset: + load_calib_dataset("cnn_dailymail") + + assert load_dataset.call_args.args[0] == "abisee/cnn_dailymail" + + +def test_other_dataset_ids_are_passed_through() -> None: + with mock.patch.object( + convert_utils, "load_dataset", return_value={"text": ["x"]} + ) as load_dataset: + load_calib_dataset("lambada") + + assert load_dataset.call_args.args[0] == "lambada" From ee0ce56036860fa6569c0c93d9a0581920c6366a Mon Sep 17 00:00:00 2001 From: lonexreb Date: Fri, 10 Jul 2026 18:54:06 -0500 Subject: [PATCH 2/2] [None][test] cover ccdv/cnn_dailymail pass-through in namespace test Ensure the already-qualified id is not rewritten (only the bare cnn_dailymail maps to abisee/cnn_dailymail). Signed-off-by: lonexreb --- .../unittest/others/test_calib_dataset_namespace.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/unittest/others/test_calib_dataset_namespace.py b/tests/unittest/others/test_calib_dataset_namespace.py index c931d72b1111..1188a000cf18 100644 --- a/tests/unittest/others/test_calib_dataset_namespace.py +++ b/tests/unittest/others/test_calib_dataset_namespace.py @@ -14,6 +14,8 @@ # limitations under the License. from unittest import mock +import pytest + import tensorrt_llm.models.convert_utils as convert_utils from tensorrt_llm.models.convert_utils import load_calib_dataset @@ -29,10 +31,13 @@ def test_bare_cnn_dailymail_is_namespaced() -> None: assert load_dataset.call_args.args[0] == "abisee/cnn_dailymail" -def test_other_dataset_ids_are_passed_through() -> None: +# ccdv/cnn_dailymail is the important boundary: the already-qualified id must +# NOT be rewritten — only the bare "cnn_dailymail" maps to abisee/cnn_dailymail. +@pytest.mark.parametrize("dataset_name", ["lambada", "ccdv/cnn_dailymail"]) +def test_other_dataset_ids_are_passed_through(dataset_name: str) -> None: with mock.patch.object( - convert_utils, "load_dataset", return_value={"text": ["x"]} + convert_utils, "load_dataset", return_value={"text": ["x"], "article": ["x"]} ) as load_dataset: - load_calib_dataset("lambada") + load_calib_dataset(dataset_name) - assert load_dataset.call_args.args[0] == "lambada" + assert load_dataset.call_args.args[0] == dataset_name