m41w4r3.exe commited on
Commit
1abfe53
1 Parent(s): 6cc2135

add gpu cuda

Browse files
Files changed (2) hide show
  1. load.py +3 -3
  2. requirements.txt +2 -1
load.py CHANGED
@@ -40,11 +40,11 @@ class LoadModel:
40
 
41
  def load_model(self):
42
  if self.revision is None:
43
- model = GPT2LMHeadModel.from_pretrained(self.path).to(self.device)
44
  else:
45
  model = GPT2LMHeadModel.from_pretrained(
46
- self.path, revision=self.revision
47
- ).to(self.device)
48
 
49
  return model
50
 
 
40
 
41
  def load_model(self):
42
  if self.revision is None:
43
+ model = GPT2LMHeadModel.from_pretrained(self.path, device_map="auto")
44
  else:
45
  model = GPT2LMHeadModel.from_pretrained(
46
+ self.path, revision=self.revision, device_map="auto"
47
+ )
48
 
49
  return model
50
 
requirements.txt CHANGED
@@ -13,4 +13,5 @@ scipy
13
  datetime
14
  torch
15
  torchvision
16
- pyFluidSynth
 
 
13
  datetime
14
  torch
15
  torchvision
16
+ pyFluidSynth
17
+ accelerate