Julian Bilcke commited on
Commit ·
347756a
1
Parent(s): 5a793ee
small fix
Browse files135 unmodified lines13613713813914014114219 unmodified lines16216316416516616716816911 unmodified lines18118218318418518618718818919022 unmodified lines213214215216217218219135 unmodified linesNumber of copied pairs"""gr.Info("Copying assets to the training dataset..")# Get project ID from global configconfig = load_global_config()19 unmodified linesall_files = video_files + image_filesnb_copied_pairs = 0for file_path in all_files:caption = ""file_caption_path = file_path.with_suffix('.txt')11 unmodified lineslogger.debug(f"Found parent caption file: {parent_caption_path}")parent_caption = parent_caption_path.read_text().strip()target_file_path = training_videos_path / file_path.nametarget_caption_path = target_file_path.with_suffix('.txt')if parent_caption and not caption.endswith(parent_caption):caption = f"{caption}\n{parent_caption}"22 unmodified linestraining_path, _, _, _ = get_project_paths(project_id)prepare_finetrainers_dataset(training_path, training_videos_path)gr.Info(f"Successfully generated the training dataset ({nb_copied_pairs} pairs)")return nb_copied_pairs135 unmodified lines13613713813914014114219 unmodified lines16216316416516616716816917017117217317417517617717811 unmodified lines19019119219319419522 unmodified lines218219220221222223224225226227135 unmodified linesNumber of copied pairs"""gr.Info("Copying new assets to the training dataset..")# Get project ID from global configconfig = load_global_config()19 unmodified linesall_files = video_files + image_filesnb_copied_pairs = 0nb_skipped_pairs = 0for file_path in all_files:target_file_path = training_videos_path / file_path.nametarget_caption_path = target_file_path.with_suffix('.txt')# Skip if both file and caption already exist in training directoryif target_file_path.exists() and target_caption_path.exists():logger.debug(f"Skipping {file_path.name} - already exists in training directory")nb_skipped_pairs += 1continuecaption = ""file_caption_path = file_path.with_suffix('.txt')11 unmodified lineslogger.debug(f"Found parent caption file: {parent_caption_path}")parent_caption = parent_caption_path.read_text().strip()if parent_caption and not caption.endswith(parent_caption):caption = f"{caption}\n{parent_caption}"22 unmodified linestraining_path, _, _, _ = get_project_paths(project_id)prepare_finetrainers_dataset(training_path, training_videos_path)if nb_skipped_pairs > 0:gr.Info(f"Successfully updated the training dataset ({nb_copied_pairs} new pairs, {nb_skipped_pairs} already existed)")else:gr.Info(f"Successfully generated the training dataset ({nb_copied_pairs} pairs)")return nb_copied_pairs
vms/utils/finetrainers_utils.py+14-6