mirror of
https://github.com/storytold/FineTrainers-Conditioning.git
synced 2026-11-02 18:06:16 +00:00
saving more changes related to args.
This commit is contained in:
+1
-1
@@ -163,7 +163,7 @@ cython_debug/
|
|||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
ltx-video/samples
|
||||||
# manually added
|
# manually added
|
||||||
wandb/
|
wandb/
|
||||||
*.txt
|
*.txt
|
||||||
|
|||||||
@@ -556,7 +556,7 @@ def _add_dataset_arguments(parser: argparse.ArgumentParser) -> None:
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--pose_column",
|
"--pose_column",
|
||||||
type=str,
|
type=str,
|
||||||
default="text",
|
default=None,
|
||||||
help="The column of the dataset containing the instance prompt for each video. Or, the name of the file in `--data_root` folder containing the line-separated instance prompts.",
|
help="The column of the dataset containing the instance prompt for each video. Or, the name of the file in `--data_root` folder containing the line-separated instance prompts.",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|||||||
+18
-9
@@ -46,11 +46,11 @@ class ImageOrVideoDataset(Dataset):
|
|||||||
data_root: str,
|
data_root: str,
|
||||||
caption_column: str,
|
caption_column: str,
|
||||||
video_column: str,
|
video_column: str,
|
||||||
pose_column: str,
|
|
||||||
resolution_buckets: List[Tuple[int, int, int]],
|
resolution_buckets: List[Tuple[int, int, int]],
|
||||||
dataset_file: Optional[str] = None,
|
dataset_file: Optional[str] = None,
|
||||||
id_token: Optional[str] = None,
|
id_token: Optional[str] = None,
|
||||||
remove_llm_prefixes: bool = False,
|
remove_llm_prefixes: bool = False,
|
||||||
|
pose_column: str = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
@@ -178,8 +178,20 @@ class ImageOrVideoDataset(Dataset):
|
|||||||
|
|
||||||
prompt_path = self.data_root.joinpath(self.caption_column)
|
prompt_path = self.data_root.joinpath(self.caption_column)
|
||||||
video_path = self.data_root.joinpath(self.video_column)
|
video_path = self.data_root.joinpath(self.video_column)
|
||||||
pose_path = self.data_root.joinpath(self.pose_column)
|
|
||||||
|
if self.pose_column != None:
|
||||||
|
pose_path = self.data_root.joinpath(self.pose_column)
|
||||||
|
pose_conditioning = True
|
||||||
|
|
||||||
|
if not pose_path.exists() or not pose_path.is_file() or not self.pose_column:
|
||||||
|
pose_conditioning = False
|
||||||
|
|
||||||
|
if pose_conditioning:
|
||||||
|
with open(pose_path, "r", encoding="utf-8") as file:
|
||||||
|
pose_paths = [self.data_root.joinpath(line.strip()) for line in file.readlines() if len(line.strip()) > 0]
|
||||||
|
else:
|
||||||
|
pose_paths = None
|
||||||
|
|
||||||
if not prompt_path.exists() or not prompt_path.is_file():
|
if not prompt_path.exists() or not prompt_path.is_file():
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Expected `--caption_column` to be path to a file in `--data_root` containing line-separated text prompts."
|
"Expected `--caption_column` to be path to a file in `--data_root` containing line-separated text prompts."
|
||||||
@@ -188,16 +200,13 @@ class ImageOrVideoDataset(Dataset):
|
|||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Expected `--video_column` to be path to a file in `--data_root` containing line-separated paths to video data in the same directory."
|
"Expected `--video_column` to be path to a file in `--data_root` containing line-separated paths to video data in the same directory."
|
||||||
)
|
)
|
||||||
if not pose_path.exists() or not pose_path.is_file():
|
|
||||||
raise ValueError(
|
|
||||||
"Expected `--pose_column` to be path to a file in `--data_root` containing line-separated paths to video data in the same directory."
|
|
||||||
)
|
|
||||||
with open(prompt_path, "r", encoding="utf-8") as file:
|
with open(prompt_path, "r", encoding="utf-8") as file:
|
||||||
prompts = [line.strip() for line in file.readlines() if len(line.strip()) > 0]
|
prompts = [line.strip() for line in file.readlines() if len(line.strip()) > 0]
|
||||||
with open(video_path, "r", encoding="utf-8") as file:
|
with open(video_path, "r", encoding="utf-8") as file:
|
||||||
video_paths = [self.data_root.joinpath(line.strip()) for line in file.readlines() if len(line.strip()) > 0]
|
video_paths = [self.data_root.joinpath(line.strip()) for line in file.readlines() if len(line.strip()) > 0]
|
||||||
with open(pose_path, "r", encoding="utf-8") as file:
|
|
||||||
pose_paths = [self.data_root.joinpath(line.strip()) for line in file.readlines() if len(line.strip()) > 0]
|
|
||||||
|
|
||||||
if any(not path.is_file() for path in video_paths):
|
if any(not path.is_file() for path in video_paths):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ def post_latent_preparation(
|
|||||||
return {"latents": latents, "num_frames": num_frames, "height": height, "width": width}
|
return {"latents": latents, "num_frames": num_frames, "height": height, "width": width}
|
||||||
|
|
||||||
|
|
||||||
def collate_fn_t2v(batch: List[List[Dict[str, torch.Tensor]]]) -> Dict[str, torch.Tensor]:
|
def collate_fn_t2v_cond(batch: List[List[Dict[str, torch.Tensor]]]) -> Dict[str, torch.Tensor]:
|
||||||
return {
|
return {
|
||||||
"prompts": [x["prompt"] for x in batch[0]],
|
"prompts": [x["prompt"] for x in batch[0]],
|
||||||
"videos": torch.stack([x["video"] for x in batch[0]]),
|
"videos": torch.stack([x["video"] for x in batch[0]]),
|
||||||
@@ -189,6 +189,13 @@ def collate_fn_t2v(batch: List[List[Dict[str, torch.Tensor]]]) -> Dict[str, torc
|
|||||||
"img_refs": torch.stack([x["img_ref"] for x in batch[0]])
|
"img_refs": torch.stack([x["img_ref"] for x in batch[0]])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def collate_fn_t2v(batch: List[List[Dict[str, torch.Tensor]]]) -> Dict[str, torch.Tensor]:
|
||||||
|
return {
|
||||||
|
"prompts": [x["prompt"] for x in batch[0]],
|
||||||
|
"videos": torch.stack([x["video"] for x in batch[0]]),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def forward_pass(
|
def forward_pass(
|
||||||
transformer: LTXVideoTransformer3DModel,
|
transformer: LTXVideoTransformer3DModel,
|
||||||
|
|||||||
Reference in New Issue
Block a user