Matthev00 commited on
Commit
6cb3c0b
1 Parent(s): 2dd4bbb

deleted utils.py references

Browse files
Files changed (2) hide show
  1. app.py +0 -1
  2. model.py +11 -6
app.py CHANGED
@@ -4,7 +4,6 @@ import torch
4
 
5
  from model import create_effnetb2
6
  from timeit import default_timer as timer
7
- from typing import Tuple, Dict
8
 
9
 
10
  def main():
 
4
 
5
  from model import create_effnetb2
6
  from timeit import default_timer as timer
 
7
 
8
 
9
  def main():
model.py CHANGED
@@ -1,9 +1,14 @@
1
- import sys
2
- sys.path.append("E:/projekty python/PyTorch course/going_modular")
 
3
 
4
- from torch import nn # noqa 5501
5
- import utils # noqa 5501
6
- import torchvision # noqa 5501
 
 
 
 
7
 
8
 
9
  def create_effnetb2(out_features,
@@ -15,7 +20,7 @@ def create_effnetb2(out_features,
15
  for param in model.features.parameters():
16
  param.requires_grad = False
17
 
18
- utils.set_seeds(42)
19
 
20
  # # Set cllasifier to suit problem
21
  model.classifier = nn.Sequential(
 
1
+ from torch import nn
2
+ import torchvision
3
+ import torch
4
 
5
+
6
+ def set_seeds(seed: int = 42):
7
+
8
+ # Set the seed for general torch operations
9
+ torch.manual_seed(seed)
10
+ # Set the seed for CUDA torch operations (ones that happen on the GPU)
11
+ torch.cuda.manual_seed(seed)
12
 
13
 
14
  def create_effnetb2(out_features,
 
20
  for param in model.features.parameters():
21
  param.requires_grad = False
22
 
23
+ set_seeds(42)
24
 
25
  # # Set cllasifier to suit problem
26
  model.classifier = nn.Sequential(