weecology / weecology/DeepForest

Add seperate config for predict batch size and train batch size.

Open
#889 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
Python
Stars
774
Forks
265
PR merge metrics
No merged PRs in 30d

Description

Updating model weights takes alot more GPU memory than just a forward model pass.

predict.tile is slower than it needs to be because its using trainer.predict, which inherits a dataloader with batch size set by the global config https://github.com/weecology/DeepForest/blob/3dbc8342de766f1f504d3c2da69c1fbc2443da42/src/deepforest/main.py#L348

and in train gets from load_dataset.

https://github.com/weecology/DeepForest/blob/3dbc8342de766f1f504d3c2da69c1fbc2443da42/src/deepforest/main.py#L335

the default is 1 because training is unknown size GPU (probably should be 2)

  1. Make a predict_batch_size and a train_batch_size config arg
  2. Update defaults to 2 for train and 8 for predict.
  3. update the config doc
  4. Write tests showing the dataloaders of each are yielding correct sizes.

I'm unsure about the val dataloader batch size, maybe should be higher, not clear to me the GPU memory. I think val batch size should be the predict size, since no weights are updated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/deepforest/main.py around the dataloader setup at lines 335 and 348, then trace how the global batch-size config reaches training and prediction. Add separate train and predict settings with the requested defaults, resolve whether validation follows prediction, update the config documentation, and add tests that verify each dataloader batch size.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, machine-learning, testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.