Skip to content
Closed
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
5 changes: 5 additions & 0 deletions tensorrt_llm/models/convert_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
43 changes: 43 additions & 0 deletions tests/unittest/others/test_calib_dataset_namespace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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 pytest

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"


# 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"], "article": ["x"]}
) as load_dataset:
load_calib_dataset(dataset_name)

assert load_dataset.call_args.args[0] == dataset_name