Skip to content

Question : evaluation after every training epoch #178

@Yongtae723

Description

@Yongtae723

Thank you

Hello!
I am Yongtae, a senior ML engineer in japan.
Thank you for publishing a genuinely excellent paper and code.
Few-shot learning and multilingual support are appreciated by engineers like me who work abroad!

Question

I felt this model easily overfit to train data if the number of epochs is over 2 or train data contains similar data.
Therefore I would like to evaluate the model after every training epoch to find out the best epoch number.

But as shown here, it seems difficult to evaluate the model at every epoch, because the body part is trained on full epoch at the beginning of the training.

so I would like to change like below

for epoch in num_epochs:
    self.model.model_body.fit(
                train_objectives=[(train_dataloader, train_loss)],
                epochs=1,
                steps_per_epoch=train_steps,
                optimizer_params={"lr": learning_rate},
                warmup_steps=warmup_steps,
                show_progress_bar=True,
                use_amp=self.use_amp,
            )

    if not is_differentiable_head or not self._freeze:
            # Train the final classifier
            self.model.fit(
                x_train,
                y_train,
                num_epochs=1,
                batch_size=batch_size,
                learning_rate=learning_rate,
                body_learning_rate=body_learning_rate,
                l2_weight=l2_weight,
                show_progress_bar=True,
            )

    somehow_evaluete()

Does it make sense to you?
Or if I fork and make that change, are there any problem?

I am looking forward to your reply

Best and thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions