Unverified Commit 159885ad authored by Sayak Paul's avatar Sayak Paul Committed by GitHub
Browse files

correct hub_token exposition behaviour (thanks to @bghira). (#6918)

parent 7337eea5
...@@ -786,6 +786,12 @@ def parse_args(): ...@@ -786,6 +786,12 @@ def parse_args():
def main(args): def main(args):
logging_dir = os.path.join(args.output_dir, args.logging_dir) logging_dir = os.path.join(args.output_dir, args.logging_dir)
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir) accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir)
kwargs = InitProcessGroupKwargs(timeout=timedelta(seconds=7200)) # a big number for high resolution or big dataset kwargs = InitProcessGroupKwargs(timeout=timedelta(seconds=7200)) # a big number for high resolution or big dataset
......
...@@ -897,6 +897,12 @@ def encode_prompt(prompt_batch, text_encoders, tokenizers, proportion_empty_prom ...@@ -897,6 +897,12 @@ def encode_prompt(prompt_batch, text_encoders, tokenizers, proportion_empty_prom
def main(args): def main(args):
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = Path(args.output_dir, args.logging_dir) logging_dir = Path(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir) accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir)
......
...@@ -467,6 +467,12 @@ def encode_prompt(text_encoder, input_ids): ...@@ -467,6 +467,12 @@ def encode_prompt(text_encoder, input_ids):
def main(args): def main(args):
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = Path(args.output_dir, args.logging_dir) logging_dir = Path(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir) accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir)
......
...@@ -491,6 +491,12 @@ def encode_prompt(text_encoders, text_input_ids_list): ...@@ -491,6 +491,12 @@ def encode_prompt(text_encoders, text_input_ids_list):
def main(args): def main(args):
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = Path(args.output_dir, args.logging_dir) logging_dir = Path(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir) accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir)
......
...@@ -386,6 +386,12 @@ def download_image(url): ...@@ -386,6 +386,12 @@ def download_image(url):
def main(): def main():
args = parse_args() args = parse_args()
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
if args.non_ema_revision is not None: if args.non_ema_revision is not None:
deprecate( deprecate(
"non_ema_revision!=None", "non_ema_revision!=None",
......
...@@ -362,6 +362,13 @@ def freeze_params(params): ...@@ -362,6 +362,13 @@ def freeze_params(params):
def main(): def main():
args = parse_args() args = parse_args()
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = os.path.join(args.output_dir, args.logging_dir) logging_dir = os.path.join(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir) accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir)
accelerator = Accelerator( accelerator = Accelerator(
......
...@@ -392,6 +392,12 @@ DATASET_NAME_MAPPING = { ...@@ -392,6 +392,12 @@ DATASET_NAME_MAPPING = {
def main(): def main():
args = parse_args() args = parse_args()
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = os.path.join(args.output_dir, args.logging_dir) logging_dir = os.path.join(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration( accelerator_project_config = ProjectConfiguration(
......
...@@ -681,6 +681,12 @@ class PromptDataset(Dataset): ...@@ -681,6 +681,12 @@ class PromptDataset(Dataset):
def main(args): def main(args):
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = Path(args.output_dir, args.logging_dir) logging_dir = Path(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration( accelerator_project_config = ProjectConfiguration(
total_limit=args.checkpoints_total_limit, project_dir=args.output_dir, logging_dir=logging_dir total_limit=args.checkpoints_total_limit, project_dir=args.output_dir, logging_dir=logging_dir
......
...@@ -548,6 +548,12 @@ class TextualInversionDataset(Dataset): ...@@ -548,6 +548,12 @@ class TextualInversionDataset(Dataset):
def main(): def main():
args = parse_args() args = parse_args()
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = os.path.join(args.output_dir, args.logging_dir) logging_dir = os.path.join(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration( accelerator_project_config = ProjectConfiguration(
total_limit=args.checkpoints_total_limit, project_dir=args.output_dir, logging_dir=logging_dir total_limit=args.checkpoints_total_limit, project_dir=args.output_dir, logging_dir=logging_dir
......
...@@ -412,6 +412,12 @@ def parse_args(): ...@@ -412,6 +412,12 @@ def parse_args():
def main(): def main():
args = parse_args() args = parse_args()
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
if args.non_ema_revision is not None: if args.non_ema_revision is not None:
deprecate( deprecate(
"non_ema_revision!=None", "non_ema_revision!=None",
......
...@@ -561,6 +561,12 @@ class TextualInversionDataset(Dataset): ...@@ -561,6 +561,12 @@ class TextualInversionDataset(Dataset):
def main(): def main():
args = parse_args() args = parse_args()
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = os.path.join(args.output_dir, args.logging_dir) logging_dir = os.path.join(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration( accelerator_project_config = ProjectConfiguration(
total_limit=args.checkpoints_total_limit, project_dir=args.output_dir, logging_dir=logging_dir total_limit=args.checkpoints_total_limit, project_dir=args.output_dir, logging_dir=logging_dir
......
...@@ -277,6 +277,12 @@ def parse_args(): ...@@ -277,6 +277,12 @@ def parse_args():
def main(args): def main(args):
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = os.path.join(args.output_dir, args.logging_dir) logging_dir = os.path.join(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration( accelerator_project_config = ProjectConfiguration(
total_limit=args.checkpoints_total_limit, project_dir=args.output_dir, logging_dir=logging_dir total_limit=args.checkpoints_total_limit, project_dir=args.output_dir, logging_dir=logging_dir
......
...@@ -531,6 +531,12 @@ def collate_fn(examples): ...@@ -531,6 +531,12 @@ def collate_fn(examples):
def main(args): def main(args):
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = Path(args.output_dir, args.logging_dir) logging_dir = Path(args.output_dir, args.logging_dir)
accelerator = Accelerator( accelerator = Accelerator(
......
...@@ -776,6 +776,12 @@ def collate_fn(examples): ...@@ -776,6 +776,12 @@ def collate_fn(examples):
def main(args): def main(args):
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = Path(args.output_dir, args.logging_dir) logging_dir = Path(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir) accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir)
......
...@@ -498,6 +498,12 @@ def parse_args(): ...@@ -498,6 +498,12 @@ def parse_args():
def main(): def main():
args = parse_args() args = parse_args()
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
if args.non_ema_revision is not None: if args.non_ema_revision is not None:
deprecate( deprecate(
"non_ema_revision!=None", "non_ema_revision!=None",
......
...@@ -245,6 +245,12 @@ def get_params_to_save(params): ...@@ -245,6 +245,12 @@ def get_params_to_save(params):
def main(): def main():
args = parse_args() args = parse_args()
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
datefmt="%m/%d/%Y %H:%M:%S", datefmt="%m/%d/%Y %H:%M:%S",
......
...@@ -377,6 +377,12 @@ DATASET_NAME_MAPPING = { ...@@ -377,6 +377,12 @@ DATASET_NAME_MAPPING = {
def main(): def main():
args = parse_args() args = parse_args()
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = Path(args.output_dir, args.logging_dir) logging_dir = Path(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir) accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir)
......
...@@ -482,6 +482,12 @@ def encode_prompt(text_encoders, tokenizers, prompt, text_input_ids_list=None): ...@@ -482,6 +482,12 @@ def encode_prompt(text_encoders, tokenizers, prompt, text_input_ids_list=None):
def main(args): def main(args):
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = Path(args.output_dir, args.logging_dir) logging_dir = Path(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir) accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir)
......
...@@ -573,6 +573,12 @@ def generate_timestep_weights(args, num_timesteps): ...@@ -573,6 +573,12 @@ def generate_timestep_weights(args, num_timesteps):
def main(args): def main(args):
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = Path(args.output_dir, args.logging_dir) logging_dir = Path(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir) accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir)
......
...@@ -579,6 +579,12 @@ class TextualInversionDataset(Dataset): ...@@ -579,6 +579,12 @@ class TextualInversionDataset(Dataset):
def main(): def main():
args = parse_args() args = parse_args()
if args.report_to == "wandb" and args.hub_token is not None:
raise ValueError(
"You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
" Please use `huggingface-cli login` to authenticate with the Hub."
)
logging_dir = os.path.join(args.output_dir, args.logging_dir) logging_dir = os.path.join(args.output_dir, args.logging_dir)
accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir) accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir)
accelerator = Accelerator( accelerator = Accelerator(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment