Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement a custom training loop #526

Unanswered
yahia3200 asked this question in Q&A
Discussion options

I have a use case where I want to write a custom training loop with the models defined in the library. I checked the Implementing New Supervised Architectures guide but I don't see how I can use this in my case. Also, I want to pass some extra data to the model in the training time similar to this Learning to Reweight Examples for Robust Deep Learning

You must be logged in to vote

Replies: 1 comment

Comment options

Hey there, @yahia3200! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this together!

To implement a custom training loop in pytorch_tabular, you can use the low-level API provided by the TabularModel. This allows you to access and modify the training process. Here's a general approach:

  1. Access the Training Loop: Use the prepare_dataloader, prepare_model, and train methods of the TabularModel to set up and customize the training loop. This gives you control over data preparation, model initialization, and the training process itself [1] .

  2. Pass Extra Data: While the documentation does not explicitly cover passing additional data during training, you can modify the data preparation step to include extra data. This might involve customizing the TabularDatamodule to handle additional inputs [2] .

  3. Custom Training Logic: You can integrate custom logic, such as reweighting examples, by modifying the training loop. This might involve adjusting the loss computation or data sampling strategy to incorporate the additional data or reweighting logic.

Unfortunately, there are no specific examples or tutorials in the documentation that demonstrate implementing a custom training loop or passing additional data in this manner [1] [2] . However, leveraging the flexibility of the low-level API and PyTorch Lightning's features should allow you to achieve your goals.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /