Dreambooth: use warnings instead of logger in parse_args() (#1688)

Use warnings instead of logger in parse_args()

logger requires an `Accelerator`.
This commit is contained in:
Pedro Cuenca 2022-12-13 22:01:48 +01:00 committed by GitHub
parent 8b7cb962a5
commit 784beee969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import hashlib
import itertools import itertools
import math import math
import os import os
import warnings
from pathlib import Path from pathlib import Path
from typing import Optional from typing import Optional
@ -255,10 +256,11 @@ def parse_args(input_args=None):
if args.class_prompt is None: if args.class_prompt is None:
raise ValueError("You must specify prompt for class images.") raise ValueError("You must specify prompt for class images.")
else: else:
# logger is not available yet
if args.class_data_dir is not None: if args.class_data_dir is not None:
logger.warning("You need not use --class_data_dir without --with_prior_preservation.") warnings.warn("You need not use --class_data_dir without --with_prior_preservation.")
if args.class_prompt is not None: if args.class_prompt is not None:
logger.warning("You need not use --class_prompt without --with_prior_preservation.") warnings.warn("You need not use --class_prompt without --with_prior_preservation.")
return args return args