Skip to content

Commit 2ce35a2

Browse files
brandenkmurrayUbuntu
andauthored
Fix Issue #39030: AutoTokenizer.from_pretrained does not propagate token (#40956)
* fix merge conflicts * change token typing --------- Co-authored-by: Ubuntu <ubuntu@ip-172-31-27-253.ec2.internal>
1 parent 6e51ac3 commit 2ce35a2

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

src/transformers/processing_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,7 @@ def get_processor_dict(
963963
local_files_only=local_files_only,
964964
revision=revision,
965965
cache_dir=cache_dir,
966+
token=token,
966967
):
967968
additional_chat_template_files[template] = f"{CHAT_TEMPLATE_DIR}/{template}.jinja"
968969
except EntryNotFoundError:

src/transformers/tokenization_utils_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,6 +2042,7 @@ def from_pretrained(
20422042
local_files_only=local_files_only,
20432043
revision=revision,
20442044
cache_dir=cache_dir,
2045+
token=token,
20452046
):
20462047
template = template.removesuffix(".jinja")
20472048
vocab_files[f"chat_template_{template}"] = f"{CHAT_TEMPLATE_DIR}/{template}.jinja"

src/transformers/utils/hub.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ def list_repo_templates(
155155
local_files_only: bool,
156156
revision: Optional[str] = None,
157157
cache_dir: Optional[str] = None,
158+
token: Union[bool, str, None] = None,
158159
) -> list[str]:
159160
"""List template files from a repo.
160161
@@ -171,6 +172,7 @@ def list_repo_templates(
171172
revision=revision,
172173
path_in_repo=CHAT_TEMPLATE_DIR,
173174
recursive=False,
175+
token=token,
174176
)
175177
if entry.path.endswith(".jinja")
176178
]

0 commit comments

Comments
 (0)