Skip to content

Commit

Permalink
Merge branch 'master' into more-gpu-test-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 authored Feb 18, 2025
2 parents 064cfda + 9b8fd2b commit c35e0b6
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pytorch-version-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
python-version: [3.9, "3.10", "3.11"]
pytorch-version:
[2.4.1, 2.3.1, 2.2.2, 2.0.1, 1.13.1, 1.12.1, 1.10.0]
[2.5.1, 2.4.1, 2.3.1, 2.2.2, 1.13.1, 1.12.1, 1.10.0]
exclude:
- pytorch-version: 1.10.0
python-version: "3.10"
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
shell: bash -l {0}
run: |
conda install pytorch=${{ matrix.pytorch-version }} torchvision cpuonly python=${{ matrix.python-version }} -c pytorch
# We should install numpy<2.0 for pytorch<2.3
numpy_one_pth_version=$(python -c "import torch; print(float('.'.join(torch.__version__.split('.')[:2])) < 2.3)")
if [ "${numpy_one_pth_version}" == "True" ]; then
Expand Down
2 changes: 1 addition & 1 deletion docker/docker.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[DEFAULT]
build_docker_image_pytorch_version = 2.5.1-cuda12.4-cudnn9
build_docker_image_pytorch_version = 2.6.0-cuda12.4-cudnn9
build_docker_image_hvd_version = v0.28.1
build_docker_image_msdp_version = v0.14.0
2 changes: 2 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ def run(self):
"https://github.com/pytorch/ignite/tree/master/examples/cifar10#check-resume-training",
"https://github.com/pytorch/ignite/tree/master/examples/mnist#training-save--resume",
"https://machinelearningmastery.com/gentle-introduction-backpropagation-time/",
"https://github.com/pytorch/pytorch/issues/7844#issuecomment-503713840",
"https://github.com/pytorch/pytorch/issues/23430#issuecomment-562350407",
]


Expand Down
10 changes: 5 additions & 5 deletions examples/notebooks/FashionMNIST.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"source": [
"The code below first sets up transform using `torhvision transfroms` for converting images to pytorch tensors and normalizing the images.\n",
"\n",
"Next, We use `torchvision datasets` for dowloading the fashion mnist dataset and applying transforms which we defined above.\n",
"Next, We use `torchvision datasets` for downloading the fashion mnist dataset and applying transforms which we defined above.\n",
"\n",
"* `trainset` contains the training data.\n",
"* `validationset` contains the validation data\n",
Expand Down Expand Up @@ -342,7 +342,7 @@
"source": [
"### EarlyStopping - Tracking Validation Loss\n",
"\n",
"Now we will setup a `EarlyStopping` handler for this training process. EarlyStopping requires a score_function that allows the user to define whatever criteria to stop trainig. In this case, if the loss of the validation set does not decrease in 10 epochs, the training process will stop early. Since the `EarlyStopping` handler relies on the validation loss, it's attached to the `val_evaluator`. "
"Now we will setup a `EarlyStopping` handler for this training process. EarlyStopping requires a score_function that allows the user to define whatever criteria to stop training. In this case, if the loss of the validation set does not decrease in 10 epochs, the training process will stop early. Since the `EarlyStopping` handler relies on the validation loss, it's attached to the `val_evaluator`. "
]
},
{
Expand Down Expand Up @@ -605,7 +605,7 @@
"classes = ['T-shirt/top','Trouser','Pullover','Dress','Coat','Sandal','Shirt','Sneaker','Bag','Ankle Boot']\n",
"# creating iterator for iterating the dataset\n",
"dataiter = iter(val_loader)\n",
"images, labels = dataiter.next()\n",
"images, labels = next(dataiter)\n",
"images_arr = []\n",
"labels_arr = []\n",
"pred_arr = []\n",
Expand All @@ -621,7 +621,7 @@
"# plotting the results\n",
"fig = plt.figure(figsize=(25,4))\n",
"for i in range(10):\n",
" ax = fig.add_subplot(2, 20/2, i+1, xticks=[], yticks=[])\n",
" ax = fig.add_subplot(2, 20//2, i+1, xticks=[], yticks=[])\n",
" ax.imshow(images_arr[i].resize_(1, 28, 28).numpy().squeeze())\n",
" ax.set_title(\"{} ({})\".format(classes[pred_arr[i]], classes[labels_arr[i]]),\n",
" color=(\"green\" if pred_arr[i]==labels_arr[i] else \"red\"))"
Expand All @@ -633,7 +633,7 @@
"id": "cWXOEpQ4abyv"
},
"source": [
"### Refrences \n",
"### References \n",
"* [Pytorch Ignite Text CNN example notebook](https://github.com/pytorch/ignite/blob/master/examples/notebooks/TextCNN.ipynb)\n",
"* [Pytorch Ignite MNIST example](https://github.com/pytorch/ignite/blob/master/examples/mnist/mnist.py)"
]
Expand Down
6 changes: 3 additions & 3 deletions examples/notebooks/TextCNN.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
"batch_size = 8 # A batch size of 8\n",
"\n",
"def create_iterators(batch_size=8):\n",
" \"\"\"Heler function to create the iterators\"\"\"\n",
" \"\"\"Helper function to create the iterators\"\"\"\n",
" dataloaders = []\n",
" for split in [train_list, validation_list, test_list]:\n",
" dataloader = DataLoader(\n",
Expand Down Expand Up @@ -695,7 +695,7 @@
"Similar to the training process function, we set up a function to evaluate a single batch. Here is what the eval_function does:\n",
"\n",
"* Sets model in eval mode.\n",
"* With torch.no_grad(), no gradients are calculated for any succeding steps.\n",
"* With torch.no_grad(), no gradients are calculated for any succeeding steps.\n",
"* Generates x and y from batch.\n",
"* Performs a forward pass on the model to calculate y_pred based on model and x.\n",
"* Returns y_pred and y.\n",
Expand Down Expand Up @@ -1002,4 +1002,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
2 changes: 1 addition & 1 deletion ignite/metrics/clustering/calinski_harabasz_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class CalinskiHarabaszScore(_ClusteringMetricBase):
.. testoutput::
5.733935121807529
5.733936
.. versionadded:: 0.5.2
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/ignite/metrics/test_confusion_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def test_miou():

res = iou_metric.compute().numpy()

assert res == true_res_
assert pytest.approx(res) == true_res_

for ignore_index in range(3):
cm = ConfusionMatrix(num_classes=3)
Expand All @@ -271,7 +271,7 @@ def test_miou():
cm.update(output)
res = iou_metric.compute().numpy()
true_res_ = np.mean(true_res[:ignore_index] + true_res[ignore_index + 1 :])
assert res == true_res_, f"{ignore_index}: {res} vs {true_res_}"
assert pytest.approx(res) == true_res_, f"{ignore_index}: {res} vs {true_res_}"


def test_cm_accuracy():
Expand Down

0 comments on commit c35e0b6

Please sign in to comment.