Skip to content

Commit ed78c93

Browse files
train_text_to_image_qat.py
1 parent 9f1cd58 commit ed78c93

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

examples/openvino/stable-diffusion/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ accelerate
22
diffusers
33
torch~=1.13
44
nncf @ git+https://github.com/openvinotoolkit/nncf.git
5-
tomesd @ git+https://github.com/AlexKoff88/tomesd/tree/openvino
5+
tomesd @ git+https://github.com/AlexKoff88/tomesd.git@openvino

examples/openvino/stable-diffusion/train_text_to_image_qat.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
DIFFUSION_MODEL_VAE_ENCODER_SUBFOLDER,
6060
)
6161

62-
6362
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
6463

6564
random.seed(42)
@@ -223,7 +222,7 @@ def copy_to(self, parameters: Iterable[torch.nn.Parameter]) -> None:
223222
param.data.copy_(s_param.data)
224223

225224
def to(self, device=None, dtype=None) -> None:
226-
r"""Move internal buffers of the ExponentialMovingAverage to `device`.
225+
"""Move internal buffers of the ExponentialMovingAverage to `device`.
227226
228227
Args:
229228
device: like `device` argument to `torch.Tensor.to`
@@ -313,7 +312,7 @@ def parse_args():
313312
type=str,
314313
default=None,
315314
choices=["DDIM", "DDPM", "LMSDiscrete"],
316-
help="The noise scheduler for the Diffusion pipiline used for training.",
315+
help="The noise scheduler for the Diffusion pipeline used for training.",
317316
)
318317
parser.add_argument(
319318
"--beta_start",
@@ -337,7 +336,7 @@ def parse_args():
337336
"--noise_schedule_steps",
338337
type=int,
339338
default=1000,
340-
help=("The noise scheduler max train timestemps"),
339+
help="The noise scheduler max train timestamps",
341340
)
342341
parser.add_argument(
343342
"--center_crop",
@@ -540,7 +539,7 @@ def parse_args():
540539
type=str,
541540
default="mean_min_max",
542541
choices=["min_max", "mean_min_max", "threesigma"],
543-
help="They way how to estimate activation quantization paramters at the initializatin step before QAT.",
542+
help="They way how to estimate activation quantization parameters at the initialization step before QAT.",
544543
)
545544
parser.add_argument(
546545
"--tune_quantizers_only",
@@ -775,7 +774,7 @@ def main():
775774
gradient_accumulation_steps=args.gradient_accumulation_steps,
776775
mixed_precision=args.mixed_precision,
777776
log_with=args.report_to,
778-
logging_dir=logging_dir,
777+
project_dir=logging_dir,
779778
)
780779

781780
logging.basicConfig(
@@ -994,8 +993,8 @@ def collate_fn(examples):
994993
args.max_train_steps = args.num_train_epochs * num_update_steps_per_epoch
995994
overrode_max_train_steps = True
996995

997-
unet, optimizer, train_dataloader, lr_scheduler = accelerator.prepare(
998-
unet, optimizer, train_dataloader, lr_scheduler
996+
optimizer, train_dataloader, lr_scheduler = accelerator.prepare(
997+
optimizer, train_dataloader, lr_scheduler
999998
)
1000999

10011000
weight_dtype = torch.float32
@@ -1120,7 +1119,7 @@ def collate_fn(examples):
11201119

11211120
accelerator.end_training()
11221121

1123-
# Export optimized pipline to OpenVINO
1122+
# Export optimized pipeline to OpenVINO
11241123
export_unet = compression_controller.strip(do_copy=False)
11251124
export_pipeline = StableDiffusionPipeline(
11261125
text_encoder=text_encoder,

0 commit comments

Comments
 (0)