peder commited on
Commit
316436b
·
1 Parent(s): 433fe3f

torch numberrdss

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -117,7 +117,8 @@ class TextGeneration:
117
  torch_dtype=DTYPE, low_cpu_mem_usage=False if DEVICE == "cpu" else True
118
  ).to(device=DEVICE, non_blocking=True)
119
  _ = self.model.eval()
120
- device_number = -1 if DEVICE == "cpu" else int(DEVICE.split(":")[-1])
 
121
  self.generator = pipeline(
122
  self.task, model=self.model, tokenizer=self.tokenizer, device=device_number)
123
  print("Done")
 
117
  torch_dtype=DTYPE, low_cpu_mem_usage=False if DEVICE == "cpu" else True
118
  ).to(device=DEVICE, non_blocking=True)
119
  _ = self.model.eval()
120
+ # -1 if DEVICE == "cpu" else int(DEVICE.split(":")[-1])
121
+ device_number = torch.cuda.current_device()
122
  self.generator = pipeline(
123
  self.task, model=self.model, tokenizer=self.tokenizer, device=device_number)
124
  print("Done")