mirror of
https://github.com/facefusion/facefusion-labs.git
synced 2026-05-22 23:59:40 +02:00
Rename to resume_path only
This commit is contained in:
@@ -53,7 +53,7 @@ max_epochs = 4096
|
||||
[training.output]
|
||||
directory_path = .outputs
|
||||
file_pattern = arcface_converter_simswap_{epoch}_{step}
|
||||
resume_file_path = .outputs/last.ckpt
|
||||
resume_path = .outputs/last.ckpt
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
@@ -17,7 +17,7 @@ max_epochs =
|
||||
[training.output]
|
||||
directory_path =
|
||||
file_pattern =
|
||||
resume_file_path =
|
||||
resume_path =
|
||||
|
||||
[exporting]
|
||||
directory_path =
|
||||
|
||||
@@ -3,7 +3,6 @@ import random
|
||||
|
||||
import cv2
|
||||
from torch import Tensor
|
||||
|
||||
from torch.utils.data import Dataset
|
||||
from torchvision import transforms
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ def create_trainer() -> Trainer:
|
||||
|
||||
def train() -> None:
|
||||
dataset_file_pattern = CONFIG.get('training.dataset', 'file_pattern')
|
||||
resume_file_path = CONFIG.get('training.output', 'resume_file_path')
|
||||
output_resume_path = CONFIG.get('training.output', 'resume_path')
|
||||
|
||||
dataset = DynamicDataset(dataset_file_pattern)
|
||||
training_loader, validation_loader = create_loaders(dataset)
|
||||
@@ -128,7 +128,7 @@ def train() -> None:
|
||||
tuner = Tuner(trainer)
|
||||
tuner.lr_find(embedding_converter_trainer, training_loader, validation_loader)
|
||||
|
||||
if os.path.exists(resume_file_path):
|
||||
trainer.fit(embedding_converter_trainer, training_loader, validation_loader, ckpt_path = resume_file_path)
|
||||
if os.path.exists(output_resume_path):
|
||||
trainer.fit(embedding_converter_trainer, training_loader, validation_loader, ckpt_path = output_resume_path)
|
||||
else:
|
||||
trainer.fit(embedding_converter_trainer, training_loader, validation_loader)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, TypeAlias
|
||||
from typing import Any, TypeAlias
|
||||
|
||||
from numpy.typing import NDArray
|
||||
from torch import Tensor
|
||||
|
||||
@@ -84,7 +84,7 @@ preview_frequency = 250
|
||||
[training.output]
|
||||
directory_path = .outputs
|
||||
file_pattern = face-swapper_{epoch}_{step}
|
||||
resume_file_path = .outputs/last.ckpt
|
||||
resume_path = .outputs/last.ckpt
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
@@ -42,7 +42,7 @@ preview_frequency =
|
||||
[training.output]
|
||||
directory_path =
|
||||
file_pattern =
|
||||
resume_file_path =
|
||||
resume_path =
|
||||
|
||||
[exporting]
|
||||
directory_path =
|
||||
|
||||
@@ -129,7 +129,7 @@ def train() -> None:
|
||||
same_person_probability = CONFIG.getfloat('preparing.dataset', 'same_person_probability')
|
||||
batch_size = CONFIG.getint('training.loader', 'batch_size')
|
||||
num_workers = CONFIG.getint('training.loader', 'num_workers')
|
||||
resume_file_path = CONFIG.get('training.output', 'resume_file_path')
|
||||
output_resume_path = CONFIG.get('training.output', 'resume_path')
|
||||
|
||||
dataset = DataLoader(dataset_path, dataset_image_pattern, dataset_directory_pattern, same_person_probability)
|
||||
training_loader = TorchDataLoader(dataset, batch_size = batch_size, shuffle = True, num_workers = num_workers, drop_last = True, pin_memory = True, persistent_workers = True)
|
||||
@@ -137,7 +137,7 @@ def train() -> None:
|
||||
face_swapper_trainer = FaceSwapperTrainer()
|
||||
trainer = create_trainer()
|
||||
|
||||
if os.path.isfile(resume_file_path):
|
||||
trainer.fit(face_swapper_trainer, training_loader, validation_loader, ckpt_path = resume_file_path)
|
||||
if os.path.isfile(output_resume_path):
|
||||
trainer.fit(face_swapper_trainer, training_loader, validation_loader, ckpt_path = output_resume_path)
|
||||
else:
|
||||
trainer.fit(face_swapper_trainer, training_loader, validation_loader)
|
||||
|
||||
Reference in New Issue
Block a user