Skip to content

Commit a8738a9

Browse files
rravenelRene RavenelArthurZucker
authored
Arg name correction: auth_token -> token (#1621)
* Arg name correction: auth_token -> token * Arg name correction in .rs: auth_token -> token * update from_pretrained.rs file as well --------- Co-authored-by: Rene Ravenel <[email protected]> Co-authored-by: Arthur Zucker <[email protected]>
1 parent 9b77c05 commit a8738a9

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

bindings/python/py_src/tokenizers/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ class Tokenizer:
971971
pass
972972

973973
@staticmethod
974-
def from_pretrained(identifier, revision="main", auth_token=None):
974+
def from_pretrained(identifier, revision="main", token=None):
975975
"""
976976
Instantiate a new :class:`~tokenizers.Tokenizer` from an existing file on the
977977
Hugging Face Hub.
@@ -982,7 +982,7 @@ class Tokenizer:
982982
a tokenizer.json file
983983
revision (:obj:`str`, defaults to `main`):
984984
A branch or commit id
985-
auth_token (:obj:`str`, `optional`, defaults to `None`):
985+
token (:obj:`str`, `optional`, defaults to `None`):
986986
An optional auth token used to access private repositories on the
987987
Hugging Face Hub
988988

bindings/python/src/tokenizer.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -578,19 +578,19 @@ impl PyTokenizer {
578578
/// a tokenizer.json file
579579
/// revision (:obj:`str`, defaults to `main`):
580580
/// A branch or commit id
581-
/// auth_token (:obj:`str`, `optional`, defaults to `None`):
581+
/// token (:obj:`str`, `optional`, defaults to `None`):
582582
/// An optional auth token used to access private repositories on the
583583
/// Hugging Face Hub
584584
///
585585
/// Returns:
586586
/// :class:`~tokenizers.Tokenizer`: The new tokenizer
587587
#[staticmethod]
588-
#[pyo3(signature = (identifier, revision = String::from("main"), auth_token = None))]
589-
#[pyo3(text_signature = "(identifier, revision=\"main\", auth_token=None)")]
588+
#[pyo3(signature = (identifier, revision = String::from("main"), token = None))]
589+
#[pyo3(text_signature = "(identifier, revision=\"main\", token=None)")]
590590
fn from_pretrained(
591591
identifier: &str,
592592
revision: String,
593-
auth_token: Option<String>,
593+
token: Option<String>,
594594
) -> PyResult<Self> {
595595
let path = Python::with_gil(|py| -> PyResult<String> {
596596
let huggingface_hub = PyModule::import_bound(py, intern!(py, "huggingface_hub"))?;
@@ -601,8 +601,8 @@ impl PyTokenizer {
601601
(intern!(py, "revision"), &revision),
602602
]
603603
.into_py_dict_bound(py);
604-
if let Some(auth_token) = auth_token {
605-
kwargs.set_item(intern!(py, "token"), auth_token)?;
604+
if let Some(token) = token {
605+
kwargs.set_item(intern!(py, "token"), token)?;
606606
}
607607
let path: String = hf_hub_download.call((), Some(&kwargs))?.extract()?;
608608
Ok(path)

tokenizers/src/utils/from_pretrained.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ use std::path::PathBuf;
88
pub struct FromPretrainedParameters {
99
pub revision: String,
1010
pub user_agent: HashMap<String, String>,
11-
pub auth_token: Option<String>,
11+
pub token: Option<String>,
1212
}
1313

1414
impl Default for FromPretrainedParameters {
1515
fn default() -> Self {
1616
Self {
1717
revision: "main".into(),
1818
user_agent: HashMap::new(),
19-
auth_token: None,
19+
token: None,
2020
}
2121
}
2222
}
@@ -60,7 +60,7 @@ pub fn from_pretrained<S: AsRef<str>>(
6060
}
6161

6262
let mut builder = ApiBuilder::new();
63-
if let Some(token) = params.auth_token {
63+
if let Some(token) = params.token {
6464
builder = builder.with_token(Some(token));
6565
}
6666
let api = builder.build()?;

0 commit comments

Comments
 (0)