versae commited on
Commit
29fe73a
1 Parent(s): 7b5b0a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -106,6 +106,7 @@ class TextGeneration:
106
  set_seed(42)
107
 
108
  def load(self):
 
109
  self.tokenizer = AutoTokenizer.from_pretrained(
110
  self.model_name_or_path, use_auth_token=HF_AUTH_TOKEN if HF_AUTH_TOKEN else None,
111
  )
@@ -117,6 +118,7 @@ class TextGeneration:
117
  _ = self.model.eval()
118
  device_number = -1 if DEVICE == "cpu" else int(DEVICE.split(":")[-1])
119
  self.generator = pipeline(self.task, model=self.model, tokenizer=self.tokenizer, device=device_number)
 
120
  # with torch.no_grad():
121
  # tokens = tokenizer.encode(prompt, return_tensors='pt').to(device=device, non_blocking=True)
122
  # gen_tokens = self.model.generate(tokens, do_sample=True, temperature=0.8, max_length=128)
 
106
  set_seed(42)
107
 
108
  def load(self):
109
+ logger.info("Loading model", end="")
110
  self.tokenizer = AutoTokenizer.from_pretrained(
111
  self.model_name_or_path, use_auth_token=HF_AUTH_TOKEN if HF_AUTH_TOKEN else None,
112
  )
 
118
  _ = self.model.eval()
119
  device_number = -1 if DEVICE == "cpu" else int(DEVICE.split(":")[-1])
120
  self.generator = pipeline(self.task, model=self.model, tokenizer=self.tokenizer, device=device_number)
121
+ logger.info("Done")
122
  # with torch.no_grad():
123
  # tokens = tokenizer.encode(prompt, return_tensors='pt').to(device=device, non_blocking=True)
124
  # gen_tokens = self.model.generate(tokens, do_sample=True, temperature=0.8, max_length=128)