from transformers import TrainingArguments, Trainer | |
model_name = model_ckpt.split("/")[-1] | |
new_model_name = f"{model_name}-finetuned-ucf101-subset" | |
num_epochs = 4 | |
args = TrainingArguments( | |
new_model_name, | |
remove_unused_columns=False, | |
evaluation_strategy="epoch", | |
save_strategy="epoch", | |
learning_rate=5e-5, | |
per_device_train_batch_size=batch_size, | |
per_device_eval_batch_size=batch_size, | |
warmup_ratio=0.1, | |
logging_steps=10, | |
load_best_model_at_end=True, | |
metric_for_best_model="accuracy", | |
push_to_hub=True, | |
max_steps=(train_dataset.num_videos // batch_size) * num_epochs, | |
) | |
The dataset returned by pytorchvideo.data.Ucf101() doesn't implement the __len__ method. |