Skip to content

Commit 354b68c

Browse files
authored
Merge branch 'main' into add-matplotlib
2 parents f988562 + d55a262 commit 354b68c

10 files changed

+78
-11
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import os
2+
from github import Github
3+
import sys
4+
import re
5+
6+
def main():
7+
token = os.environ.get('GITHUB_TOKEN')
8+
9+
repo_owner = "pytorch"
10+
repo_name = "tutorials"
11+
pull_request_number = int(sys.argv[1])
12+
13+
g = Github(token)
14+
repo = g.get_repo(f'{repo_owner}/{repo_name}')
15+
pull_request = repo.get_pull(pull_request_number)
16+
pull_request_body = pull_request.body
17+
18+
# get issue number from the PR body
19+
if not re.search(r'#\d{1,5}', pull_request_body):
20+
print("The pull request does not mention an issue.")
21+
return
22+
issue_number = int(re.findall(r'#(\d{1,5})', pull_request_body)[0])
23+
issue = repo.get_issue(issue_number)
24+
issue_labels = issue.labels
25+
docathon_label_present = any(label.name == 'docathon-h1-2023' for label in issue_labels)
26+
27+
# if the issue has a docathon label, add all labels from the issue to the PR.
28+
if not docathon_label_present:
29+
print("The 'docathon-h1-2023' label is not present in the issue.")
30+
return
31+
pull_request_labels = pull_request.get_labels()
32+
issue_label_names = [label.name for label in issue_labels]
33+
labels_to_add = [label for label in issue_label_names if label not in pull_request_labels]
34+
if not labels_to_add:
35+
print("The pull request already has the same labels.")
36+
return
37+
pull_request.set_labels(*labels_to_add)
38+
print("Labels added to the pull request!")
39+
40+
41+
42+
if __name__ == "__main__":
43+
main()
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Docathon Labels Sync
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, edited]
6+
7+
jobs:
8+
check-labels:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check if PR mentions an issue and get labels
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: 3.x
20+
- name: Install dependencies
21+
run: |
22+
pip install requests
23+
pip install PyGithub
24+
- name: Run Python script
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: python ./.github/scripts/docathon-label-sync.py ${{ github.event.pull_request.number }}

advanced_source/super_resolution_with_onnxruntime.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
and `ONNX Runtime <https://github.com/microsoft/onnxruntime>`__.
1717
You can get binary builds of ONNX and ONNX Runtime with
1818
``pip install onnx onnxruntime``.
19-
Note that ONNX Runtime is compatible with Python versions 3.5 to 3.7.
20-
21-
``NOTE``: This tutorial needs PyTorch master branch which can be installed by following
22-
the instructions `here <https://github.com/pytorch/pytorch#from-source>`__
19+
ONNX Runtime recommends using the latest stable runtime for PyTorch.
2320
2421
"""
2522

beginner_source/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ Beginner Tutorials
2323

2424
6. transformer_translation.py
2525
Language Translation with Transformers
26-
https://pytorch.org/tutorials/beginner/transformer_tutorial.html
26+
https://pytorch.org/tutorials/beginner/translation_transformer.html

beginner_source/hyperparameter_tuning_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def forward(self, x):
201201
#
202202
# The checkpoint saving is optional, however, it is necessary if we wanted to use advanced
203203
# schedulers like
204-
# `Population Based Training <https://docs.ray.io/en/master/tune/tutorials/tune-advanced-tutorial.html>`_.
204+
# `Population Based Training <https://docs.ray.io/en/latest/tune/examples/pbt_guide.html>`_.
205205
# Also, by saving the checkpoint we can later load the trained models and validate them
206206
# on a test set. Lastly, saving checkpoints is useful for fault tolerance, and it allows
207207
# us to interrupt training and continue training later.

beginner_source/transformer_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# ``nn.TransformerEncoder`` consists of multiple layers of
3838
# `nn.TransformerEncoderLayer <https://pytorch.org/docs/stable/generated/torch.nn.TransformerEncoderLayer.html>`__.
3939
# Along with the input sequence, a square attention mask is required because the
40-
# self-attention layers in ``nn.TransformerEncoder`` are only allowed to attend
40+
# self-attention layers in ``nn.TransformerDecoder`` are only allowed to attend
4141
# the earlier positions in the sequence. For the language modeling task, any
4242
# tokens on the future positions should be masked. To produce a probability
4343
# distribution over output words, the output of the ``nn.TransformerEncoder``

intermediate_source/char_rnn_classification_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
NLP From Scratch: Classifying Names with a Character-Level RNN
44
**************************************************************
5-
**Author**: `Sean Robertson <https://github.com/spro/practical-pytorch>`_
5+
**Author**: `Sean Robertson <https://github.com/spro>`_
66
77
We will be building and training a basic character-level RNN to classify
88
words. This tutorial, along with the following two, show how to do

intermediate_source/char_rnn_generation_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
NLP From Scratch: Generating Names with a Character-Level RNN
44
*************************************************************
5-
**Author**: `Sean Robertson <https://github.com/spro/practical-pytorch>`_
5+
**Author**: `Sean Robertson <https://github.com/spro>`_
66
77
This is our second of three tutorials on "NLP From Scratch".
88
In the `first tutorial </intermediate/char_rnn_classification_tutorial>`

intermediate_source/dynamic_quantization_bert_tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ built-in F1 score calculation helper function.
6868
.. code:: shell
6969
7070
pip install sklearn
71-
pip install transformers
71+
pip install transformers==4.29.2
7272
7373
7474
Because we will be using the beta parts of the PyTorch, it is

intermediate_source/seq2seq_translation_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
NLP From Scratch: Translation with a Sequence to Sequence Network and Attention
44
*******************************************************************************
5-
**Author**: `Sean Robertson <https://github.com/spro/practical-pytorch>`_
5+
**Author**: `Sean Robertson <https://github.com/spro>`_
66
77
This is the third and final tutorial on doing "NLP From Scratch", where we
88
write our own classes and functions to preprocess the data to do our NLP

0 commit comments

Comments
 (0)