Skip to content

Commit bd7a4bf

Browse files
committed
Set hf_access_token to None when not provided
1 parent 23a82de commit bd7a4bf

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/maxtext/configs/pyconfig.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ def _prepare_for_pydantic(raw_keys: dict[str, Any]) -> dict[str, Any]:
135135
new_value = [new_value]
136136

137137
# An empty value provided in the configuration is treated as None
138-
if key in ("hf_train_files", "hf_eval_files") and new_value == "":
138+
if (
139+
key in ("hf_train_files", "hf_eval_files", "hf_access_token", "hf_name", "hf_data_dir", "hf_eval_split")
140+
and new_value == ""
141+
):
139142
new_value = None
140143

141144
if key == "run_name" and new_value is None:

src/maxtext/configs/types.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -994,11 +994,11 @@ class HfDataset(BaseModel):
994994
"""Configuration specific to HuggingFace datasets."""
995995

996996
hf_path: str = Field("", description="Path of the Hugging Face dataset.")
997-
hf_name: str = Field("", description="Name of the Hugging Face dataset.")
998-
hf_data_dir: PathStr = Field("", description="Data directory for the HF dataset.")
999-
hf_train_files: Optional[str] = Field(None, description="Files for the HF training split.")
1000-
hf_eval_split: str = Field("", description="Name of the HF evaluation split.")
1001-
hf_eval_files: Optional[str] = Field(None, description="Files for the HF evaluation split.")
997+
hf_name: None | str = Field(None, description="Name of the Hugging Face dataset.")
998+
hf_data_dir: None | PathStr = Field(None, description="Data directory for the HF dataset.")
999+
hf_train_files: None | str = Field(None, description="Files for the HF training split.")
1000+
hf_eval_split: None | str = Field(None, description="Name of the HF evaluation split.")
1001+
hf_eval_files: None | str = Field(None, description="Files for the HF evaluation split.")
10021002
hf_access_token: None | str = Field(None, description="Hugging Face API access token.")
10031003

10041004

0 commit comments

Comments
 (0)