Repository: pytorch
Issue: [compile] TypeError: __init__() missing 1 required positional argument: 'parent_module'
Labels: needs reproduction,triaged,ezyang's list,oncall: pt2

### 🐛 Describe the bug

`model.compile()` (defaults) gives me:

```
stderr:  - 5543 - torch._dynamo.symbolic_convert - Step 1: torchdynamo start tracing forward
stderr: Traceback (most recent call last):
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/convert_frame.py", line 324, in _compile
stderr:     out_code = transform_code_object(code, transform)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/bytecode_transformation.py", line 445, in transform_code_object
stderr:     transformations(instructions, code_options)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/convert_frame.py", line 311, in transform
stderr:     tracer.run()
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 1726, in run
stderr:     super().run()
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 576, in run
stderr:     and self.step()
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 540, in step
stderr:     getattr(self, inst.opname)(inst)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 342, in wrapper
stderr:     return inner_fn(self, inst)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 1014, in CALL_FUNCTION_KW
stderr:     self.call_function(fn, args, kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 474, in call_function
stderr:     self.push(fn.call_function(self, args, kwargs))
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/variables/nn_module.py", line 244, in call_function
stderr:     return tx.inline_user_function_return(
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 510, in inline_user_function_return
stderr:     result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 1806, in inline_call
stderr:     return cls.inline_call_(parent, func, args, kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 1862, in inline_call_
stderr:     tracer.run()
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 576, in run
stderr:     and self.step()
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 540, in step
stderr:     getattr(self, inst.opname)(inst)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 342, in wrapper
stderr:     return inner_fn(self, inst)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 1014, in CALL_FUNCTION_KW
stderr:     self.call_function(fn, args, kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 474, in call_function
stderr:     self.push(fn.call_function(self, args, kwargs))
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/variables/nn_module.py", line 244, in call_function
stderr:     return tx.inline_user_function_return(
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 510, in inline_user_function_return
stderr:     result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 1806, in inline_call
stderr:     return cls.inline_call_(parent, func, args, kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 1862, in inline_call_
stderr:     tracer.run()
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 576, in run
stderr:     and self.step()
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 540, in step
stderr:     getattr(self, inst.opname)(inst)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 342, in wrapper
stderr:     return inner_fn(self, inst)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 965, in CALL_FUNCTION
stderr:     self.call_function(fn, args, {})
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 474, in call_function
stderr:     self.push(fn.call_function(self, args, kwargs))
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/variables/nn_module.py", line 244, in call_function
stderr:     return tx.inline_user_function_return(
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 510, in inline_user_function_return
stderr:     result = InliningInstructionTranslator.inline_call(self, fn, args, kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 1806, in inline_call
stderr:     return cls.inline_call_(parent, func, args, kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 1862, in inline_call_
stderr:     tracer.run()
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 576, in run
stderr:     and self.step()
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 540, in step
stderr:     getattr(self, inst.opname)(inst)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 342, in wrapper
stderr:     return inner_fn(self, inst)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 965, in CALL_FUNCTION
stderr:     self.call_function(fn, args, {})
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/symbolic_convert.py", line 474, in call_function
stderr:     self.push(fn.call_function(self, args, kwargs))
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/variables/nn_module.py", line 203, in call_function
stderr:     return wrap_fx_proxy(
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/variables/builder.py", line 754, in wrap_fx_proxy
stderr:     return wrap_fx_proxy_cls(
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/variables/builder.py", line 789, in wrap_fx_proxy_cls
stderr:     example_value = get_fake_value(proxy.node, tx)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/utils.py", line 1143, in get_fake_value
stderr:     nnmodule = deepcopy_to_fake_tensor(nnmodule, tx.fake_mode)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/utils.py", line 819, in deepcopy_to_fake_tensor
stderr:     return wrap_fake_exception(lambda: copy.deepcopy(obj))
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/utils.py", line 808, in wrap_fake_exception
stderr:     return fn()
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/utils.py", line 819, in <lambda>
stderr:     return wrap_fake_exception(lambda: copy.deepcopy(obj))
stderr:   File "/usr/lib/python3.8/copy.py", line 172, in deepcopy
stderr:     y = _reconstruct(x, memo, *rv)
stderr:   File "/usr/lib/python3.8/copy.py", line 270, in _reconstruct
stderr:     state = deepcopy(state, memo)
stderr:   File "/usr/lib/python3.8/copy.py", line 146, in deepcopy
stderr:     y = copier(x, memo)
stderr:   File "/usr/lib/python3.8/copy.py", line 230, in _deepcopy_dict
stderr:     y[deepcopy(key, memo)] = deepcopy(value, memo)
stderr:   File "/usr/lib/python3.8/copy.py", line 172, in deepcopy
stderr:     y = _reconstruct(x, memo, *rv)
stderr:   File "/usr/lib/python3.8/copy.py", line 264, in _reconstruct
stderr:     y = func(*args)
stderr: TypeError: __init__() missing 1 required positional argument: 'parent_module'

tderr: Set torch._dynamo.config.verbose=True for more information
stderr: 
stderr: 
stderr: You can suppress this exception and fall back to eager by setting:
stderr:     torch._dynamo.config.suppress_errors = True
stderr: 
stderr: 
stderr: The above exception was the direct cause of the following exception:
stderr: 
stderr: Traceback (most recent call last):
stderr:   File "/actions-runner/_work/m4/m4/m4/training/main.py", line 176, in <module>
stderr:     train_logs = trainer.train()
stderr:   File "/actions-runner/_work/m4/m4/m4/training/trainer.py", line 1438, in train
stderr:     ) = self._do_batch(
stderr:   File "/actions-runner/_work/m4/m4/m4/training/trainer.py", line 560, in _do_batch
stderr:     vl_output = self.vl_model(
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
stderr:     return forward_call(*args, **kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/deepspeed/utils/nvtx.py", line 11, in wrapped_fn
stderr:     ret_val = func(*args, **kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/deepspeed/runtime/engine.py", line 1832, in forward
stderr:     loss = self.module(*inputs, **kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1538, in _call_impl
stderr:     result = forward_call(*args, **kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/eval_frame.py", line 82, in forward
stderr:     return self.dynamo_ctx(self._orig_mod.forward)(*args, **kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/eval_frame.py", line 209, in _fn
stderr:     return fn(*args, **kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/eval_frame.py", line 337, in catch_errors
stderr:     return callback(frame, cache_size, hooks)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/convert_frame.py", line 404, in _convert_frame
stderr:     result = inner_convert(frame, cache_size, hooks)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/convert_frame.py", line 104, in _fn
stderr:     return fn(*args, **kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/convert_frame.py", line 262, in _convert_frame_assert
stderr:     return _compile(
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/utils.py", line 163, in time_wrapper
stderr:     r = func(*args, **kwargs)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/_dynamo/convert_frame.py", line 394, in _compile
stderr:     raise InternalTorchDynamoError() from e
stderr: torch._dynamo.exc.InternalTorchDynamoError
stderr: ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 6786) of binary: /usr/bin/python3
stderr: Traceback (most recent call last):
stderr:   File "/usr/local/bin/accelerate", line 8, in <module>
stderr:     sys.exit(main())
stderr:   File "/usr/local/lib/python3.8/dist-packages/accelerate/commands/accelerate_cli.py", line 45, in main
stderr:     args.func(args)
stderr:   File "/usr/local/lib/python3.8/dist-packages/accelerate/commands/launch.py", line 900, in launch_command
stderr:     deepspeed_launcher(args)
stderr:   File "/usr/local/lib/python3.8/dist-packages/accelerate/commands/launch.py", line 643, in deepspeed_launcher
stderr:     distrib_run.run(args)
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/distributed/run.py", line 785, in run
stderr:     elastic_launch(
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/distributed/launcher/api.py", line 134, in __call__
stderr:     return launch_agent(self._config, self._entrypoint, list(args))
stderr:   File "/usr/local/lib/python3.8/dist-packages/torch/distributed/launcher/api.py", line 250, in launch_agent
stderr:     raise ChildFailedError(
stderr: torch.distributed.elastic.multiprocessing.errors.ChildFailedError:

```

### Versions

pt-2.0

@Chillee 

cc @ezyang @msaroufim @wconstab @bdhirsh @anijain2305 @zou3519 @soumith @ngimel