(self)
| 55 | self.num_samples = min(num_samples, self.data.num_rows) |
| 56 | |
| 57 | def generate_samples(self) -> Iterable[tuple]: |
| 58 | for i, sample in enumerate(self.data): |
| 59 | if i >= self.num_samples: |
| 60 | break |
| 61 | schema = sample["schema"] |
| 62 | if os.environ.get("TRTLLM_XGUIDANCE_LENIENT") == "1": |
| 63 | schema = json.loads(schema) |
| 64 | schema["x-guidance"] = {"lenient": True} |
| 65 | schema = json.dumps(schema) |
| 66 | sampling_args = { |
| 67 | "guided_decoding": GuidedDecodingParams(json=schema) |
| 68 | } |
| 69 | yield sample["prompt"], sampling_args, sample["completion"], sample[ |
| 70 | "schema"] |
| 71 | |
| 72 | def compute_score(self, outputs: List[RequestOutput], references: List[str], |
| 73 | schemas: List[str]) -> float: |
nothing calls this directly
no test coverage detected