Skip to content

Commit

Permalink
Merge 7510b1e into cd90979
Browse files Browse the repository at this point in the history
  • Loading branch information
oke-aditya authored Mar 5, 2021
2 parents cd90979 + 7510b1e commit 22d2950
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 9 deletions.
6 changes: 3 additions & 3 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--find-links https://download.pytorch.org/whl/torch_stable.html
torch==1.7.1+cpu
torchvision==0.8.2+cpu
pytorch_lightning==1.1.0
torch==1.8.0+cpu
torchvision==0.9.0+cpu
pytorch_lightning==1.2.1
scipy==1.5.4
timm
pandas
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
torch==1.7.1
torchvision==0.8.2
pytorch_lightning==1.2.0
torch==1.8.0
torchvision==0.9.0
pytorch_lightning==1.2.1
scipy==1.5.4

6 changes: 3 additions & 3 deletions tests/test_detr.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def test_val_step(self):

def test_fit(self):
for bbone in some_supported_backbones:
backbone = detr.create_detr_backbone(bbone, pretrained="coco")
backbone = detr.create_detr_backbone(bbone, pretrained=None)
self.assertTrue(isinstance(backbone, nn.Module))
detr_model = detr.create_detr(num_classes=3, num_queries=5, backbone=backbone)
detr_model = detr_model.cpu()
Expand All @@ -156,7 +156,7 @@ def test_fit(self):
@unittest.skipIf(not torch.cuda.is_available(), "CUDA unavailable")
def test_fit_cuda(self):
for bbone in some_supported_backbones:
backbone = detr.create_detr_backbone(bbone, pretrained="coco")
backbone = detr.create_detr_backbone(bbone, pretrained=None)
self.assertTrue(isinstance(backbone, nn.Module))
detr_model = detr.create_detr(num_classes=3, num_queries=5, backbone=backbone)
self.assertTrue(isinstance(detr_model, nn.Module))
Expand Down Expand Up @@ -247,7 +247,7 @@ class LightningTester(unittest.TestCase):
def test_lit_detr(self):
flag = False
for bbone in some_supported_backbones:
model = detr.LitDETR(num_classes=3, num_queries=5, pretrained="coco", backbone=bbone)
model = detr.LitDETR(num_classes=3, num_queries=5, pretrained=None, backbone=bbone)
trainer = pl.Trainer(fast_dev_run=True, logger=False, checkpoint_callback=False)
trainer.fit(model, train_loader, val_loader)
flag = True
Expand Down
18 changes: 18 additions & 0 deletions tests/test_layers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import torch
import unittest
import torch.nn as nn
from quickvision import layers


class MishTester(unittest.TestCase):
def test_mish(self):
pass


class MLPTester(unittest.TestCase):
def test_mlp(self):
pass


if __name__ == "__main__":
unittest.main()
35 changes: 35 additions & 0 deletions tests/test_losses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import torch
import torch.nn as nn
import unittest
from quickvision import losses
from quickvision.losses import functional as fl


class DiceLossTester(unittest.TestCase):
def test_dice_loss_functional(self):
# Same thing what you do with below.
# inputs = torch.tensor([[0.4, 0.2, 0.3], [0.6, 0.2, 0.3]], dtype=torch.float32)
# targets = torch.tensor([[0], [1]], dtype=torch.float32)
# loss = fl.dice_loss(inputs, targets)
# Do a backward
# loss.backward()
# And now compare this loss with known valueQ
# self.assertTrue()
pass

def test_dice_loss(self):
# loss_fn = losses.DiceLoss()
# inputs = torch.tensor([[0.4, 0.2, 0.3], [0.6, 0.2, 0.3]], dtype=torch.float32)
# targets = torch.tensor([[0], [1]], dtype=torch.float32)
# loss = loss_fn(inputs, targets)
# See what expected loss should be
# expected_loss = []
# Compare those two with epsilon
# loss.backward()
# Assert those with epsilon case
# self.assertTrue()
pass


if __name__ == "__main__":
unittest.main()

0 comments on commit 22d2950

Please sign in to comment.