Skip to content

Commit 9a39333

Browse files
authored
Merge branch 'main' into angelayi/export_fix
2 parents c7ba991 + 8f0518c commit 9a39333

25 files changed

+918
-443
lines changed

.jenkins/validate_tutorials_built.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"intermediate_source/mnist_train_nas", # used by ax_multiobjective_nas_tutorial.py
2626
"intermediate_source/fx_conv_bn_fuser",
2727
"intermediate_source/_torch_export_nightly_tutorial", # does not work on release
28-
"intermediate_source/transformer_building_blocks", # does not work on release
2928
"advanced_source/super_resolution_with_onnxruntime",
3029
"advanced_source/usb_semisup_learn", # fails with CUDA OOM error, should try on a different worker
3130
"prototype_source/fx_graph_mode_ptq_dynamic",
@@ -52,8 +51,6 @@
5251
"intermediate_source/text_to_speech_with_torchaudio",
5352
"intermediate_source/tensorboard_profiler_tutorial", # reenable after 2.0 release.
5453
"advanced_source/pendulum",
55-
"beginner_source/onnx/export_simple_model_to_onnx_tutorial",
56-
"beginner_source/onnx/onnx_registry_tutorial"
5754
]
5855

5956
def tutorial_source_dirs() -> List[Path]:
38.1 KB
Loading
-34 KB
Binary file not shown.
-7.37 KB
Binary file not shown.
-15.9 KB
Binary file not shown.
-8.41 KB
Binary file not shown.
-381 Bytes
Loading
60.5 KB
Loading
-94.9 KB
Binary file not shown.

beginner_source/basics/buildmodel_tutorial.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,10 @@
3232
#############################################
3333
# Get Device for Training
3434
# -----------------------
35-
# We want to be able to train our model on a hardware accelerator like the GPU or MPS,
36-
# if available. Let's check to see if `torch.cuda <https://pytorch.org/docs/stable/notes/cuda.html>`_
37-
# or `torch.backends.mps <https://pytorch.org/docs/stable/notes/mps.html>`_ are available, otherwise we use the CPU.
38-
39-
device = (
40-
"cuda"
41-
if torch.cuda.is_available()
42-
else "mps"
43-
if torch.backends.mps.is_available()
44-
else "cpu"
45-
)
35+
# We want to be able to train our model on an `accelerator <https://pytorch.org/docs/stable/torch.html#accelerators>`__
36+
# such as CUDA, MPS, MTIA, or XPU. If the current accelerator is available, we will use it. Otherwise, we use the CPU.
37+
38+
device = torch.accelerator.current_accelerator().type if torch.accelerator.is_available() else "cpu"
4639
print(f"Using {device} device")
4740

4841
##############################################

0 commit comments

Comments
 (0)