Anonumous commited on
Commit
75db912
·
verified ·
1 Parent(s): a36a4c2

Update modeling_borealis.py

Browse files
Files changed (1) hide show
  1. modeling_borealis.py +2 -7
modeling_borealis.py CHANGED
@@ -145,11 +145,6 @@ class BorealisForConditionalGeneration(PreTrainedModel, PyTorchModelHubMixin):
145
  )
146
  return out.loss, out.logits
147
 
148
- def extract_assistant_content(self, text: str) -> str:
149
- if "assistant\n" in text:
150
- return text.split("assistant\n")[-1].strip()
151
- return text.strip()
152
-
153
  @torch.no_grad()
154
  def generate(
155
  self,
@@ -235,9 +230,9 @@ class BorealisForConditionalGeneration(PreTrainedModel, PyTorchModelHubMixin):
235
  else:
236
  txt = self.tokenizer.batch_decode(gen_ids, skip_special_tokens=True)
237
  if single:
238
- return self.extract_assistant_content(txt[0])
239
  else:
240
- return [self.extract_assistant_content(t) for t in txt]
241
 
242
  def save_pretrained(self, save_directory, **kwargs):
243
  os.makedirs(save_directory, exist_ok=True)
 
145
  )
146
  return out.loss, out.logits
147
 
 
 
 
 
 
148
  @torch.no_grad()
149
  def generate(
150
  self,
 
230
  else:
231
  txt = self.tokenizer.batch_decode(gen_ids, skip_special_tokens=True)
232
  if single:
233
+ return txt[0]
234
  else:
235
+ return [t for t in txt]
236
 
237
  def save_pretrained(self, save_directory, **kwargs):
238
  os.makedirs(save_directory, exist_ok=True)