"...api/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "3c79dd9dbefda94df32c6947589fd3416b74b80a"
Unverified Commit 0c63c383 authored by YiYi Xu's avatar YiYi Xu Committed by GitHub
Browse files

allow use custom local dataset for controlnet training scripts (#2928)



use custom local datset
Co-authored-by: default avataryiyixuxu <yixu310@gmail,com>
Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
parent a87e88b7
...@@ -542,16 +542,13 @@ def make_train_dataset(args, tokenizer, accelerator): ...@@ -542,16 +542,13 @@ def make_train_dataset(args, tokenizer, accelerator):
cache_dir=args.cache_dir, cache_dir=args.cache_dir,
) )
else: else:
data_files = {}
if args.train_data_dir is not None: if args.train_data_dir is not None:
data_files["train"] = os.path.join(args.train_data_dir, "**") dataset = load_dataset(
dataset = load_dataset( args.train_data_dir,
"imagefolder", cache_dir=args.cache_dir,
data_files=data_files, )
cache_dir=args.cache_dir,
)
# See more about loading custom images at # See more about loading custom images at
# https://huggingface.co/docs/datasets/v2.4.0/en/image_load#imagefolder # https://huggingface.co/docs/datasets/v2.0.0/en/dataset_script
# Preprocessing the datasets. # Preprocessing the datasets.
# We need to tokenize inputs and targets. # We need to tokenize inputs and targets.
......
...@@ -477,16 +477,13 @@ def make_train_dataset(args, tokenizer, batch_size=None): ...@@ -477,16 +477,13 @@ def make_train_dataset(args, tokenizer, batch_size=None):
streaming=args.streaming, streaming=args.streaming,
) )
else: else:
data_files = {}
if args.train_data_dir is not None: if args.train_data_dir is not None:
data_files["train"] = os.path.join(args.train_data_dir, "**") dataset = load_dataset(
dataset = load_dataset( args.train_data_dir,
"imagefolder", cache_dir=args.cache_dir,
data_files=data_files, )
cache_dir=args.cache_dir,
)
# See more about loading custom images at # See more about loading custom images at
# https://huggingface.co/docs/datasets/v2.4.0/en/image_load#imagefolder # https://huggingface.co/docs/datasets/v2.0.0/en/dataset_script
# Preprocessing the datasets. # Preprocessing the datasets.
# We need to tokenize inputs and targets. # We need to tokenize inputs and targets.
......
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