shenweichen / shenweichen/DeepCTR-Torch

TensorDataset with DataLoader could lead bad performance

Open
#70 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.5k
Forks
733
PR merge metrics
No merged PRs in 30d

Description

Describe the bug(问题描述)
TensorDataset with DataLoader will lead to slow data reading. Use simple tensor slicing could have ~4x speed improvement (especially in large batch size).

Additional context
Relative code:

https://github.com/shenweichen/DeepCTR-Torch/blob/687a094135fa597697d926782a5634c79b627dac/deepctr_torch/models/basemodel.py#L186-L193

Relative discussion:

https://github.com/pytorch/pytorch/issues/4959

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 at deepctr_torch/models/basemodel.py lines 186-193 and compare the TensorDataset/DataLoader path with the simple tensor-slicing approach described in the issue. Read the linked PyTorch discussion for relevant context, then verify the change with a representative large-batch data-reading benchmark. Done means the affected model path avoids the reported slowdown and shows improved performance.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.