Skip to content

Commit 79d56de

Browse files
authored
Merge branch 'main' into zhiwei/xpu_quant
2 parents 5a6663a + 02d2519 commit 79d56de

9 files changed

+15
-7
lines changed

.ci/docker/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ tensorboard
2828
jinja2==3.1.3
2929
pytorch-lightning
3030
torchx
31-
torchrl==0.6.0
32-
tensordict==0.6.0
31+
torchrl==0.7.2
32+
tensordict==0.7.2
3333
ax-platform>=0.4.0
3434
nbformat>=5.9.2
3535
datasets

.jenkins/post_process_notebooks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
# Pattern to search ``` {.python .jupyter-code-cell}
15-
pattern = re.compile(r'(.*?)``` {.python .jupyter-code-cell}\n\n(from IPython.display import display, HTML\nhtml_code = """\n.*?\n"""\ndisplay\(HTML\(html_code\)\))\n```(.*)', re.DOTALL)
15+
pattern = re.compile(r'(.*?)``` {\.python \.jupyter-code-cell}\n(.*?from IPython\.display import display, HTML.*?display\(HTML\(html_code\)\))\n```(.*)', re.DOTALL)
1616

1717

1818
def process_video_cell(notebook_path):

.jenkins/validate_tutorials_built.py

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"intermediate_source/flask_rest_api_tutorial",
5151
"intermediate_source/text_to_speech_with_torchaudio",
5252
"intermediate_source/tensorboard_profiler_tutorial", # reenable after 2.0 release.
53+
"advanced_source/semi_structured_sparse" # reenable after 3303 is fixed.
5354
]
5455

5556
def tutorial_source_dirs() -> List[Path]:

advanced_source/coding_ddpg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ def ceil_div(x, y):
10401040

10411041
###############################################################################
10421042
# let's use the TD(lambda) estimator!
1043-
loss_module.make_value_estimator(ValueEstimators.TDLambda, gamma=gamma, lmbda=lmbda)
1043+
loss_module.make_value_estimator(ValueEstimators.TDLambda, gamma=gamma, lmbda=lmbda, device=device)
10441044

10451045
###############################################################################
10461046
# .. note::

advanced_source/cpp_extension.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1207,3 +1207,5 @@ examples displayed in this note `here
12071207
<https://github.com/pytorch/extension-cpp>`_. If you have questions, please use
12081208
`the forums <https://discuss.pytorch.org>`_. Also be sure to check our `FAQ
12091209
<https://pytorch.org/cppdocs/notes/faq.html>`_ in case you run into any issues.
1210+
A blog on writing extensions for AMD ROCm can be found `here
1211+
<https://rocm.blogs.amd.com/artificial-intelligence/cpp-extn/readme.html>`_.

advanced_source/python_custom_ops.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ def crop(pic: torch.Tensor, box: Sequence[int]) -> torch.Tensor:
112112
def _(pic, box):
113113
channels = pic.shape[0]
114114
x0, y0, x1, y1 = box
115-
return pic.new_empty(channels, y1 - y0, x1 - x0)
115+
result = pic.new_empty(y1 - y0, x1 - x0, channels).permute(2, 0, 1)
116+
# The result should have the same metadata (shape/strides/``dtype``/device)
117+
# as running the ``crop`` function above.
118+
return result
116119

117120
######################################################################
118121
# After this, ``crop`` now works without graph breaks:

advanced_source/semi_structured_sparse.py

+2
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@
210210
SparseSemiStructuredTensor._FORCE_CUTLASS = True
211211
torch.manual_seed(100)
212212

213+
# Set default device to "cuda:0"
214+
torch.set_default_device(torch.device("cuda:0" if torch.cuda.is_available() else "cpu"))
213215

214216
######################################################################
215217
# We’ll also need to define some helper functions that are specific to the

intermediate_source/pinmem_nonblock.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ def pin_copy_to_device_nonblocking(*tensors):
547547

548548
i = -1
549549
for i in range(100):
550-
# Create a tensor in pin-memory
550+
# Create a tensor in pageable memory
551551
cpu_tensor = torch.ones(1024, 1024)
552552
torch.cuda.synchronize()
553553
# Send the tensor to CUDA

intermediate_source/reinforcement_ppo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@
551551
#
552552

553553
advantage_module = GAE(
554-
gamma=gamma, lmbda=lmbda, value_network=value_module, average_gae=True
554+
gamma=gamma, lmbda=lmbda, value_network=value_module, average_gae=True, device=device,
555555
)
556556

557557
loss_module = ClipPPOLoss(

0 commit comments

Comments
 (0)