waterfall 0.2.6__tar.gz → 0.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: waterfall
3
- Version: 0.2.6
3
+ Version: 0.2.8
4
4
  Summary: Scalable Framework for Robust Text Watermarking and Provenance for LLMs
5
5
  Project-URL: Homepage, https://github.com/aoi3142/Waterfall
6
6
  Project-URL: Issues, https://github.com/aoi3142/Waterfall/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "waterfall"
7
- version = "0.2.6"
7
+ version = "0.2.8"
8
8
  authors = [
9
9
  { name = "Xinyuan Niu", email="aperture@outlook.sg" }
10
10
  ]
@@ -227,6 +227,7 @@ class Watermarker:
227
227
  return_scores : bool = False,
228
228
  use_tqdm : bool = False,
229
229
  batched_generate : bool = True,
230
+ discard_incomplete : bool = True,
230
231
  **kwargs # Other generate parameters
231
232
  ) -> List[str] | dict: # Returns flattened list of query x beam
232
233
 
@@ -305,7 +306,10 @@ class Watermarker:
305
306
  tokenizer=self.tokenizer,
306
307
  **kwargs
307
308
  )
308
- output = output[:,tokd_input_batch["input_ids"].shape[-1]:].to("cpu", non_blocking=True)
309
+ output = output[:,tokd_input_batch["input_ids"].shape[-1]:]
310
+ if discard_incomplete:
311
+ output[output[:, -1] != self.tokenizer.eos_token_id] = self.tokenizer.eos_token_id
312
+ output = output.to("cpu", non_blocking=True)
309
313
  outputs.append(output)
310
314
  bar.update(tokd_input_batch["input_ids"].shape[0])
311
315
  torch.cuda.synchronize()
File without changes
File without changes
File without changes
File without changes
File without changes