Error when using torch.compile with Pytorch2.0
Labels: needs reproduction, triaged, oncall: pt2

### 🐛 Describe the bug

I tried `torch.compile` on the stable_diffusion model. But I got the following error. Could you give me a hand? Thanks!

#### Codebase
https://github.com/huggingface/diffusers/blob/main/examples/text_to_image

#### Code modification
https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image.py#L541
```
    text_encoder.to(accelerator.device, dtype=weight_dtype)
    vae.to(accelerator.device, dtype=weight_dtype)
    # add this
    text_encoder = torch.compile(text_encoder)
```

#### my command
```
export MODEL_NAME="CompVis/stable-diffusion-v1-4"
export dataset_name="lambdalabs/pokemon-blip-captions"

accelerate launch train_text_to_image.py \
          --pretrained_model_name_or_path=$MODEL_NAME \
          --dataset_name=$dataset_name \
          --use_ema \
          --resolution=512 --center_crop --random_flip \
          --train_batch_size=1 \
          --gradient_accumulation_steps=1 \
          --mixed_precision="fp16" \
          --max_train_steps=100 \
          --learning_rate=1e-05 \
          --max_grad_norm=1 \
          --lr_scheduler="constant" --lr_warmup_steps=0 \
          --output_dir="sd-pokemon-model" 
```
#### error log
```
Steps:   0%|                                                                                                              | 0/100 [00:00<?, ?it/s][2022-12-14 09:00:20,033] torch._inductor.graph: [WARNING] Creating implicit fallback for:
  target: aten.triu_.default
  args[0]: TensorBox(StorageBox(
    ComputedBuffer(name='buf0', layout=FlexibleLayout('cpu', torch.float16, size=[2, 12, 12], stride=[144, 12, 1]), data=Pointwise(
      'cpu',
      torch.float16,
      to_dtype(constant(-65504.0, torch.float32), torch.float16),
      ranges=[2, 12, 12],
      origins={empty, _tensor_constant0, fill_, lift_fresh_copy}
    ))
  ))
  args[1]: 1
[2022-12-14 09:00:20,035] torch._inductor.lowering: [WARNING] make_fallback(aten.triu_.default): a decomposition exists, we should switch to it
[2022-12-14 09:00:20,039] torch._inductor.ir: [WARNING] Using FallbackKernel: torch.ops.aten.triu_.default
[2022-12-14 09:00:20,040] torch._inductor.ir: [WARNING] DeviceCopy
Traceback (most recent call last):
  File "/opt/conda/bin/accelerate", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.8/site-packages/accelerate/commands/accelerate_cli.py", line 45, in main
    args.func(args)
  File "/opt/conda/lib/python3.8/site-packages/accelerate/commands/launch.py", line 1104, in launch_command
    simple_launcher(args)
  File "/opt/conda/lib/python3.8/site-packages/accelerate/commands/launch.py", line 567, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/opt/conda/bin/python3.8', 'train_text_to_image.py', '--pretrained_model_name_or_path=CompVis/stable-diffusion-v1-4', '--dataset_name=lambdalabs/pokemon-blip-captions', '--use_ema', '--resolution=512', '--center_crop', '--random_flip', '--train_batch_size=2', '--gradient_accumulation_steps=1', '--mixed_precision=fp16', '--max_train_steps=100', '--learning_rate=1e-05', '--max_grad_norm=1', '--lr_scheduler=constant', '--lr_warmup_steps=0', '--output_dir=sd-pokemon-model']' died with <Signals.SIGSEGV: 11>.
```

### Versions

PyTorch version: 2.0.0.dev20221213+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.4 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: Could not collect
CMake version: version 3.25.0
Libc version: glibc-2.31

Python version: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:10)  [GCC 10.3.0] (64-bit runtime)
Python platform: Linux-5.4.0-107-generic-x86_64-with-glibc2.10
Is CUDA available: True
CUDA runtime version: 11.7.99
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA A100-SXM4-40GB
GPU 1: NVIDIA A100-SXM4-40GB
GPU 2: NVIDIA A100-SXM4-40GB
GPU 3: NVIDIA A100-SXM4-40GB
GPU 4: NVIDIA A100-SXM4-40GB
GPU 5: NVIDIA A100-SXM4-40GB
GPU 6: NVIDIA A100-SXM4-40GB
GPU 7: NVIDIA A100-SXM4-40GB

Nvidia driver version: 515.65.01
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.5.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.24.0rc2
[pip3] pytorch-quantization==2.1.2
[pip3] torch==2.0.0.dev20221213+cu117
[pip3] torch-tensorrt==1.2.0a0
[pip3] torchtext==0.11.0a0
[pip3] torchtriton==2.0.0+0d7e753227
[pip3] torchvision==0.14.0a0
[conda] mkl                       2020.4             h726a3e6_304    conda-forge
[conda] mkl-include               2020.4             h726a3e6_304    conda-forge
[conda] numpy                     1.24.0rc2                pypi_0    pypi
[conda] pytorch-quantization      2.1.2                    pypi_0    pypi
[conda] torch                     2.0.0.dev20221213+cu117          pypi_0    pypi
[conda] torch-tensorrt            1.2.0a0                  pypi_0    pypi
[conda] torchtext                 0.11.0a0                 pypi_0    pypi
[conda] torchtriton               2.0.0+0d7e753227          pypi_0    pypi
[conda] torchvision               0.14.0a0                 pypi_0    pypi


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