MCPcopy Create free account
hub / github.com/bruno686/VisPlay / validate

Method validate

configuration_utils.py:1458–1486  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1456 self.context_width = context_width
1457
1458 def validate(self):
1459 watermark_missing_arg_msg = (
1460 "Some of the keys in `watermarking_config` are defined incorrectly. `{key}` should be {correct_value}` "
1461 "but found {found_value}"
1462 )
1463 if self.seeding_scheme not in ["selfhash", "lefthash"]:
1464 raise ValueError(
1465 watermark_missing_arg_msg.format(
1466 key="seeding_scheme",
1467 correct_value="[`selfhash`, `lefthash`]",
1468 found_value=self.seeding_scheme,
1469 ),
1470 )
1471 if not 0.0 <= self.greenlist_ratio <= 1.0:
1472 raise ValueError(
1473 watermark_missing_arg_msg.format(
1474 key="greenlist_ratio",
1475 correct_value="in range between 0.0 and 1.0",
1476 found_value=self.seeding_scheme,
1477 ),
1478 )
1479 if not self.context_width >= 1:
1480 raise ValueError(
1481 watermark_missing_arg_msg.format(
1482 key="context_width",
1483 correct_value="a positive integer",
1484 found_value=self.context_width,
1485 ),
1486 )
1487
1488 def construct_processor(self, vocab_size: int, device) -> "WatermarkLogitsProcessor":
1489 return WatermarkLogitsProcessor(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected