AssertionError: Dynamo only supports FSDP with use_orig_params=True
### System Info

cuda 11.7
accelerate=0.21.0.dev0
transformers=4.31.0.dev0
torch=2.0.1
python=3.8


### Who can help?

@pacman100 

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

### command:
accelerate launch --config_file accelerate_config.yaml --num_machines 7 --num_processes 28 --machine_rank $NODE_RANK --main_process_ip $MASTER_ADDR --main_process_port $MASTER_PORT ./trainer.py --model_name_or_path ".."  --data_path ".." --per_device_train_batch_size 24 --per_device_eval_batch_size 24 --do_train --evaluation_strategy no --output_dir outputs --learning_rate 2e-5 --num_train_epochs 4 --lr_scheduler_type cosine --warmup_ratio 0.03 --weight_decay 0.0 --logging_steps 1 --save_strategy epoch --bf16 true --tf32 true --load_best_model_at_end false --model_max_length 2048 --gradient_checkpointing true --save_total_limit 1 --model_resume_from_checkpoint false --torch_compile true


### accelerate_config.yaml

```
compute_environment: LOCAL_MACHINE
distributed_type: FSDP
downcast_bf16: 'no'
fsdp_config:
  fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
  fsdp_backward_prefetch_policy: BACKWARD_PRE
  fsdp_forward_prefetch: false
  fsdp_offload_params: false
  fsdp_sharding_strategy: 1
  fsdp_state_dict_type: FULL_STATE_DICT
  fsdp_sync_module_states: true
  fsdp_transformer_layer_cls_to_wrap: LlamaDecoderLayer
  fsdp_use_orig_params: true
main_training_function: main
num_machines: 1
num_processes: 2
mixed_precision: bf16
rdzv_backend: static
tpu_env: []
tpu_use_cluster: false
tpu_use_sudo: false
use_cpu: false
```

### basic training code
```
def train():
    print("Env Variables")
    env_vars = os.environ
    for key, value in env_vars.items():
        print(key, "=", value)
    parser = transformers.HfArgumentParser(
        (ModelArguments, DataArguments, TrainingArguments))
    model_args, data_args, training_args = parser.parse_args_into_dataclasses()
    model = transformers.LlamaForCausalLM.from_pretrained(
        model_args.model_name_or_path,
        cache_dir=training_args.cache_dir,
    )

    tokenizer = transformers.AutoTokenizer.from_pretrained(
        model_args.model_name_or_path,
        cache_dir=training_args.cache_dir,
        model_max_length=training_args.model_max_length,
        padding_side="right"
    )
    
    if tokenizer.pad_token is None:
        smart_tokenizer_and_embedding_resize(
            tokenizer=tokenizer,
            model=model,
        )


    data_module = make_hf_data_module(tokenizer=tokenizer,
                                              data_args=data_args)
    trainer = Trainer(model=model,
                    tokenizer=tokenizer,
                    args=training_args,
                    **data_module)
    
    if model_args.model_resume_from_checkpoint:
        trainer.train(resume_from_checkpoint=model_args.model_name_or_path)
    else:
        trainer.train()
    trainer.save_state()
    safe_save_model_for_hf_trainer(trainer=trainer,
                                   output_dir=training_args.output_dir)
```

###Stacktrace

  

> You can suppress this exception and fall back to eager by setting:
>   torch._dynamo.config.suppress_errors = True
>   self.symbolic_locals = collections.OrderedDict(
>   File "/opt/conda/envs/ptca/lib/python3.8/site-packages/torch/_dynamo/symbolic_convert.py", line 1673, in <genexpr>
>     self.symbolic_locals = collections.OrderedDict(
>   File "/opt/conda/envs/ptca/lib/python3.8/site-packages/torch/_dynamo/symbolic_convert.py", line 1673, in <genexpr>
>     VariableBuilder(
>   File "/opt/conda/envs/ptca/lib/python3.8/site-packages/torch/_dynamo/variables/builder.py", line 172, in __call__
>     return self._wrap(value).clone(**self.options())
>   File "/opt/conda/envs/ptca/lib/python3.8/site-packages/torch/_dynamo/variables/builder.py", line 248, in _wrap
>     VariableBuilder(
>   File "/opt/conda/envs/ptca/lib/python3.8/site-packages/torch/_dynamo/variables/builder.py", line 172, in __call__
>     output = [
>   File "/opt/conda/envs/ptca/lib/python3.8/site-packages/torch/_dynamo/variables/builder.py", line 249, in <listcomp>
>     return self._wrap(value).clone(**self.options())
>   File "/opt/conda/envs/ptca/lib/python3.8/site-packages/torch/_dynamo/variables/builder.py", line 248, in _wrap
>     VariableBuilder(self.tx, GetItemSource(self.get_source(), i))(
>   File "/opt/conda/envs/ptca/lib/python3.8/site-packages/torch/_dynamo/variables/builder.py", line 172, in __call__
>     output = [
>   File "/opt/conda/envs/ptca/lib/python3.8/site-packages/torch/_dynamo/variables/builder.py", line 249, in <listcomp>
>     return self._wrap(value).clone(**self.options())
>   File "/opt/conda/envs/ptca/lib/python3.8/site-packages/torch/_dynamo/variables/builder.py", line 345, in _wrap
>     VariableBuilder(self.tx, GetItemSource(self.get_source(), i))(
>   File "/opt/conda/envs/ptca/lib/python3.8/site-packages/torch/_dynamo/variables/builder.py", line 172, in __call__
>     assert getattr(
> AssertionError: Dynamo only supports FSDP with use_orig_params=True
> 
> Set torch._dynamo.config.verbose=True for more information

### Expected behavior

torch.compile works smoothly with FSDP
The command involves `accelerate` and `torch_compile` + the error involves `Dynamo`.

cc @fxmarty @pacman100 (maybe?)<|||||>Thank you for the issue, the above PR fixes it.