alibabasglab commited on
Commit
ebde641
·
verified ·
1 Parent(s): 4760e88

Update networks.py

Browse files
Files changed (1) hide show
  1. networks.py +10 -1
networks.py CHANGED
@@ -35,6 +35,7 @@ class SpeechModel:
35
  - args: Argument parser object containing settings like whether to use CUDA (GPU) or not.
36
  """
37
  # Check if a GPU is available
 
38
  if torch.cuda.is_available():
39
  # Find the GPU with the most free memory using a custom method
40
  free_gpu_id = self.get_free_gpu()
@@ -52,7 +53,15 @@ class SpeechModel:
52
  # If no GPU is detected, use the CPU
53
  args.use_cuda = 0
54
  self.device = torch.device('cpu')
55
-
 
 
 
 
 
 
 
 
56
  self.args = args
57
  self.model = None
58
  self.name = None
 
35
  - args: Argument parser object containing settings like whether to use CUDA (GPU) or not.
36
  """
37
  # Check if a GPU is available
38
+ """
39
  if torch.cuda.is_available():
40
  # Find the GPU with the most free memory using a custom method
41
  free_gpu_id = self.get_free_gpu()
 
53
  # If no GPU is detected, use the CPU
54
  args.use_cuda = 0
55
  self.device = torch.device('cpu')
56
+ """
57
+ if torch.cuda.is_available():
58
+ print('GPU is found and used!')
59
+ self.device = torch.device('cuda')
60
+ else:
61
+ # If no GPU is detected, use the CPU
62
+ args.use_cuda = 0
63
+ self.device = torch.device('cpu')
64
+
65
  self.args = args
66
  self.model = None
67
  self.name = None