Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Minifier fails on runtime compilation minification #1690

@soumith

Description

@soumith

I tried to use the minifier when I found an issue with examples/imagenet in #1687

But it failed with

$ TORCHDYNAMO_REPRO_AFTER="aot" python main.py /home/soumith/dataset/imagenet
/home/soumith/code/vision/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension:
  warn(f"Failed to load image Python extension: {e}")
=> creating model 'resnet18'
WARNING:torch._inductor.lowering:make_fallback(aten.unfold): a decomposition exists, we should switch to it
WARNING:torch._inductor.lowering:make_fallback(aten.unfold_backward): a decomposition exists, we should switch to it
Epoch: [0][   1/5005]   Time 11.820 (11.820)    Data  1.918 ( 1.918)    Loss 6.9964e+00 (6.9964e+00)    Acc@1   0.00 (  0.00)   Acc@5   0.00 (  0.00)
WARNING:torch._dynamo.debug_utils:Writing minified repro to /tmp/minifier_soumith/minifier_launcher.py
WARNING:torch._dynamo.debug_utils:Copying minified repro from /tmp/minifier_soumith/minifier_launcher.py to /home/soumith/code/pytorch/minifier_launch
er.py for convenience
Traceback (most recent call last):
  File "/home/soumith/code/pytorch/torch/fx/interpreter.py", line 199, in placeholder
    return next(self.args_iter)
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/soumith/code/examples/imagenet/main.py", line 514, in <module>
    main()
  File "/home/soumith/code/examples/imagenet/main.py", line 121, in main
    main_worker(args.gpu, ngpus_per_node, args)
  File "/home/soumith/code/examples/imagenet/main.py", line 281, in main_worker
    train(train_loader, model, criterion, optimizer, epoch, device, args)
  File "/home/soumith/code/examples/imagenet/main.py", line 339, in train
    loss.backward()
  File "/home/soumith/code/pytorch/torch/_tensor.py", line 488, in backward
   torch.autograd.backward(
  File "/home/soumith/code/pytorch/torch/autograd/__init__.py", line 197, in backward
    Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
  File "/home/soumith/code/pytorch/torch/autograd/function.py", line 270, in apply
    return user_fn(self, *args)
  File "/home/soumith/code/pytorch/functorch/_src/aot_autograd.py", line 468, in backward
    out = call_func_with_args(
  File "/home/soumith/code/pytorch/functorch/_src/aot_autograd.py", line 255, in call_func_with_args
    out = normalize_as_list(f(args))
  File "/home/soumith/code/pytorch/torch/_dynamo/eval_frame.py", line 157, in _fn
    return fn(*args, **kwargs)
  File "/home/soumith/code/pytorch/torch/_dynamo/debug_utils.py", line 444, in deferred_for_real_inputs
    raise e
  File "/home/soumith/code/pytorch/torch/_dynamo/debug_utils.py", line 428, in deferred_for_real_inputs
    compiled_fn = compiler_fn(gm, example_inputs, **kwargs)
  File "/home/soumith/code/pytorch/torch/_inductor/debug.py", line 178, in inner
    return fn(*args, **kwargs)
  File "/home/soumith/miniconda3/envs/pytorch/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/home/soumith/code/pytorch/torch/_inductor/compile_fx.py", line 106, in compile_fx_inner
    graph.run(*example_inputs)
  File "/home/soumith/code/pytorch/torch/_dynamo/utils.py", line 85, in time_wrapper
    r = func(*args, **kwargs)
  File "/home/soumith/code/pytorch/torch/_inductor/graph.py", line 143, in run
    return super().run(*args)
  File "/home/soumith/code/pytorch/torch/fx/interpreter.py", line 130, in run
    self.env[node] = self.run_node(node)
  File "/home/soumith/code/pytorch/torch/_inductor/graph.py", line 311, in run_node
    result = super().run_node(n)
  File "/home/soumith/code/pytorch/torch/fx/interpreter.py", line 171, in run_node
    return getattr(self, n.op)(n.target, args, kwargs)
  File "/home/soumith/code/pytorch/torch/_inductor/graph.py", line 208, in placeholder
    example: torch.Tensor = super().placeholder(target, args, kwargs)
  File "/home/soumith/code/pytorch/torch/fx/interpreter.py", line 204, in placeholder
    raise RuntimeError(f'Expected positional argument for parameter {target}, but one was not passed in!')
RuntimeError: Expected positional argument for parameter primals_1, but one was not passed in!

While executing %primals_1 : [#users=1] = placeholder[target=primals_1]
Original traceback:
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions