pytorch / pytorch/benchmark

dlrm_s_pytorch.py profile api arguments mismatch

Open
#2,589 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1k
Forks
346
PR merge metrics
No merged PRs in 30d

Description

$ python -m torchbenchmark.models.dlrm.dlrm_s_pytorch --mini-batch-size=2 --data-size=6 --debug-mode
/opt/py3.10/lib/python3.10/runpy.py:126: RuntimeWarning: 'torchbenchmark.models.dlrm.dlrm_s_pytorch' found in sys.modules after import of package 'torchbenchmark.models.dlrm', but prior to execution of 'torchbenchmark.models.dlrm.dlrm_s_pytorch'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
Using CPU...
model arch:
mlp top arch 3 layers, with input to output dimensions:
[8 4 2 1]
# of interactions
8
mlp bot arch 2 layers, with input to output dimensions:
[4 3 2]
# of features (sparse and dense)
4
dense feature size
4
sparse feature size
2
# of embeddings (= # of sparse features) 3, with dimensions 2x:
[4 3 2]
data (inputs and targets):
mini-batch: 0
[[0.69647 0.28614 0.22685 0.55131]
 [0.71947 0.42311 0.98076 0.68483]]
[[1, 2], [1, 1], [1, 1]]
[[1, 0, 1], [0, 1], [1, 0]]
[[0.36179]
 [0.22826]]
mini-batch: 1
[[0.29371 0.63098 0.0921  0.4337 ]
 [0.43086 0.49369 0.42583 0.31226]]
[[1, 2], [1, 2], [1, 1]]
[[3, 0, 2], [1, 1, 2], [1, 1]]
[[0.60306]
 [0.54507]]
mini-batch: 2
[[0.34276 0.30412 0.41702 0.6813 ]
 [0.87546 0.51042 0.66931 0.58594]]
[[2, 1], [1, 2], [1, 1]]
[[2, 3, 2], [0, 0, 2], [1, 1]]
[[0.55679]
 [0.15896]]
initial parameters (weights and bias):
[[-0.34693  0.19553]
 [-0.18123  0.19197]
 [ 0.05438 -0.11105]
 [ 0.42513  0.34167]]
[[-0.16466 -0.52702]
 [-0.22543 -0.11757]
 [ 0.23667  0.57199]]
[[-0.20377  0.3713 ]
 [ 0.13177  0.27111]]
[[-0.16825 -0.58044 -0.39152 -0.64812]
 [ 1.11561  0.0879   0.61481 -0.67743]
 [ 0.09677  0.62959 -0.17907  0.55115]]
[0. 0. 0.]
[[-0.68594 -0.86234  0.23995]
 [-0.23981  0.40607 -1.25093]]
[0. 0.]
[[ 0.29078  1.06075 -0.01005  0.01394  0.0733  -0.76015  0.17397 -0.65541]
 [-0.1746   0.5074  -0.30015  0.20463  0.41345  0.1138  -0.55969 -0.13573]
 [ 0.79993 -0.82672 -0.11259 -0.2254   0.04929  0.30546  0.65675 -0.11032]
 [ 0.33164  0.20402  0.19365 -0.23022 -0.40715 -0.44909 -0.30881  0.13133]]
[0. 0. 0. 0.]
[[ 0.43933  0.18675 -0.31694  1.04268]
 [ 0.87692 -0.20438 -0.47541  0.07518]]
[0. 0.]
[[1.03474 0.2717 ]]
[0.]
time/loss/accuracy (if enabled):
Traceback (most recent call last):
  File "/opt/py3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/py3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/workspace/torch/benchmark/torchbenchmark/models/dlrm/dlrm_s_pytorch.py", line 970, in <module>
    with torch.autograd.profiler.profile(args.enable_profiling, use_gpu) as prof:
TypeError: profile.__init__() takes from 1 to 2 positional arguments but 3 were given
with torch.autograd.profiler.profile(args.enable_profiling, use_gpu) as prof:

should be changed to

with torch.autograd.profiler.profile(args.enable_profiling, use_cuda=use_gpu) as prof:

https://pytorch.org/docs/stable/autograd.html#profiler

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

Open torchbenchmark/models/dlrm/dlrm_s_pytorch.py near line 970 and compare the profiler call with the current PyTorch profiler API. Apply the issue's argument change, then rerun the provided module command with --mini-batch-size=2, --data-size=6, and --debug-mode. Done means the command no longer fails with the positional-argument TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.