Skip to content

Commit

Permalink
Fix deprecation of use_auth_token in DownloadConfig (#6094)
Browse files Browse the repository at this point in the history
Fix deprecated use_auth_token in DownloadConfig
  • Loading branch information
albertvillanova committed Jul 31, 2023
1 parent 029956a commit c30ff1d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/datasets/download/download_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import copy
import warnings
from dataclasses import dataclass, field
from dataclasses import InitVar, dataclass, field
from pathlib import Path
from typing import Any, Dict, Optional, Union

Expand Down Expand Up @@ -74,19 +74,19 @@ class DownloadConfig:
num_proc: Optional[int] = None
max_retries: int = 1
token: Optional[Union[str, bool]] = None
use_auth_token = "deprecated"
use_auth_token: InitVar[Optional[Union[str, bool]]] = "deprecated"
ignore_url_params: bool = False
storage_options: Dict[str, Any] = field(default_factory=dict)
download_desc: Optional[str] = None

def __post_init__(self):
if self.use_auth_token != "deprecated":
def __post_init__(self, use_auth_token):
if use_auth_token != "deprecated":
warnings.warn(
"'use_auth_token' was deprecated in favor of 'token' in version 2.14.0 and will be removed in 3.0.0.\n"
f"You can remove this warning by passing 'token={self.use_auth_token}' instead.",
f"You can remove this warning by passing 'token={use_auth_token}' instead.",
FutureWarning,
)
self.token = self.use_auth_token
self.token = use_auth_token
if "hf" not in self.storage_options:
self.storage_options["hf"] = {"token": self.token, "endpoint": config.HF_ENDPOINT}

Expand Down

0 comments on commit c30ff1d

Please sign in to comment.