Skip to content

Commit 6d1c9b7

Browse files
authored
Merge branch 'main' into leslie/add_x86InductorQuantizer_Performance_Number
2 parents 15bb227 + feeca53 commit 6d1c9b7

File tree

8 files changed

+27
-10
lines changed

8 files changed

+27
-10
lines changed

.github/scripts/docathon-label-sync.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ def main():
2525
issue_number = int(re.findall(r'#(\d{1,5})', pull_request_body)[0])
2626
issue = repo.get_issue(issue_number)
2727
issue_labels = issue.labels
28-
docathon_label_present = any(label.name == 'docathon-h1-2023' for label in issue_labels)
28+
docathon_label_present = any(label.name == 'docathon-h2-2023' for label in issue_labels)
2929

3030
# if the issue has a docathon label, add all labels from the issue to the PR.
3131
if not docathon_label_present:
32-
print("The 'docathon-h1-2023' label is not present in the issue.")
32+
print("The 'docathon-h2-2023' label is not present in the issue.")
3333
return
3434
pull_request_labels = pull_request.get_labels()
3535
issue_label_names = [label.name for label in issue_labels]

.github/workflows/docathon-assign.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ jobs:
3636
repo: context.repo.repo,
3737
issue_number: issueNumber
3838
});
39-
const hasLabel = issue.labels.some(label => label.name === 'docathon-h1-2023');
39+
const hasLabel = issue.labels.some(label => label.name === 'docathon-h2-2023');
4040
if (hasLabel) {
4141
if (issue.assignee !== null) {
4242
await octokit.issues.createComment({
4343
owner: context.repo.owner,
4444
repo: context.repo.repo,
4545
issue_number: issueNumber,
46-
body: "The issue is already assigned. Please pick an opened and unnasigned issue with the [docathon-h1-2023 label](https://github.com/pytorch/tutorials/issues?q=is%3Aopen+is%3Aissue+label%3Adocathon-h1-2023)."
46+
body: "The issue is already assigned. Please pick an opened and unnasigned issue with the [docathon-h2-2023 label](https://github.com/pytorch/tutorials/issues?q=is%3Aopen+is%3Aissue+label%3Adocathon-h2-2023)."
4747
});
4848
} else {
4949
octokit.issues.addAssignees({
@@ -54,7 +54,7 @@ jobs:
5454
});
5555
}
5656
} else {
57-
const commmentMessage = "This issue does not have the correct label. Please pick an opened and unnasigned issue with the [docathon-h1-2023 label](https://github.com/pytorch/tutorials/issues?q=is%3Aopen+is%3Aissue+label%3Adocathon-h1-2023)."
57+
const commmentMessage = "This issue does not have the correct label. Please pick an opened and unnasigned issue with the [docathon-h2-2023 label](https://github.com/pytorch/tutorials/issues?q=is%3Aopen+is%3Aissue+label%3Adocathon-h2-2023)."
5858
await octokit.issues.createComment({
5959
owner: context.repo.owner,
6060
repo: context.repo.repo,

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@ All the tutorials are now presented as sphinx style documentation at:
55

66
## [https://pytorch.org/tutorials](https://pytorch.org/tutorials)
77

8+
# Asking a question
89

10+
If you have a question about a tutorial, post in https://dev-discuss.pytorch.org/ rather than creating an issue in this repo. Your question will be answered much faster on the dev-discuss forum.
11+
12+
# Submitting an issue
13+
14+
You can submit the following types of issues:
15+
16+
* Feature request - request a new tutorial to be added. Please explain why this tutorial is needed and how it demonstrates PyTorch value.
17+
* Bug report - report a failiure or outdated information in an existing tutorial. When submitting a bug report, please run: `python3 -m torch.utils.collect_env` to get information about your environment and add the output to the bug report.
918

1019
# Contributing
1120

beginner_source/blitz/autograd_tutorial.py

+1
Original file line numberDiff line numberDiff line change
@@ -321,3 +321,4 @@
321321
#
322322
# - `In-place operations & Multithreaded Autograd <https://pytorch.org/docs/stable/notes/autograd.html>`__
323323
# - `Example implementation of reverse-mode autodiff <https://colab.research.google.com/drive/1VpeE6UvEPRz9HmsHh1KS0XxXjYu533EC>`__
324+
# - `Video: PyTorch Autograd Explained - In-depth Tutorial <https://www.youtube.com/watch?v=MswxJw-8PvE>`__

intermediate_source/reinforcement_ppo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
# actually return ``frame_skip`` frames).
138138
#
139139

140-
device = "cpu" if not torch.has_cuda else "cuda:0"
140+
device = "cpu" if not torch.cuda.is_available() else "cuda:0"
141141
num_cells = 256 # number of cells in each layer i.e. output dim.
142142
lr = 3e-4
143143
max_grad_norm = 1.0

intermediate_source/torch_compile_tutorial.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,15 @@ def init_model():
195195
# GPU compute and the observed speedup may be less significant.
196196
#
197197
# You may also see different speedup results depending on the chosen ``mode``
198-
# argument. Since our model and data are small, we want to reduce overhead as
199-
# much as possible, and so we chose ``"reduce-overhead"``. For your own models,
198+
# argument. The ``"reduce-overhead"`` mode uses CUDA graphs to further reduce
199+
# the overhead of Python. For your own models,
200200
# you may need to experiment with different modes to maximize speedup. You can
201201
# read more about modes `here <https://pytorch.org/get-started/pytorch-2.0/#user-experience>`__.
202202
#
203+
# You may might also notice that the second time we run our model with ``torch.compile`` is significantly
204+
# slower than the other runs, although it is much faster than the first run. This is because the ``"reduce-overhead"``
205+
# mode runs a few warm-up iterations for CUDA graphs.
206+
#
203207
# For general PyTorch benchmarking, you can try using ``torch.utils.benchmark`` instead of the ``timed``
204208
# function we defined above. We wrote our own timing function in this tutorial to show
205209
# ``torch.compile``'s compilation latency.

prototype_source/semi_structured_sparse.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ Now that those are defined, we just need one additional helper function, which w
315315
We will get started by loading our model and tokenizer, and then setting up our dataset.
316316

317317
.. code:: python
318+
318319
# load model
319320
model_name = "bert-base-cased"
320321
tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)
@@ -344,6 +345,7 @@ Running the following code gives me an F1 score of 86.9. This is quite close to
344345
training_args = transformers.TrainingArguments(
345346
"trainer",
346347
num_train_epochs=1,
348+
lr_scheduler_type="constant",
347349
per_device_train_batch_size=64,
348350
per_device_eval_batch_size=512,
349351
)
@@ -446,7 +448,7 @@ We will also evaluate the model to show the accuracy degradation of zero-shot pr
446448
with torch.inference_mode():
447449
predictions = trainer.predict(tokenized_squad_dataset["validation"])
448450
pruned = compute_metrics(
449-
*predictions.predictions
451+
*predictions.predictions,
450452
tokenized_squad_dataset["validation"],
451453
squad_dataset["validation"],
452454
)
@@ -498,7 +500,7 @@ Now that we have a model in this format, we can accelerate it for inference just
498500
print("sparse eval metrics: ", metrics_sparse)
499501
sparse_perf = measure_execution_time(
500502
model,
501-
batch_sizes_perf_cuda,
503+
batch_sizes,
502504
tokenized_squad_dataset["validation"],
503505
)
504506
print("sparse perf metrics: ", sparse_perf)

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jinja2==3.0.3
2626
pytorch-lightning
2727
torchx
2828
torchrl==0.2.0
29+
tensordict==0.2.0
2930
ax-platform
3031
nbformat>=4.2.0
3132
datasets

0 commit comments

Comments
 (0)