MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT-LLM / generate_samples

Method generate_samples

tensorrt_llm/evaluate/json_mode_eval.py:57–70  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls 2

getMethod · 0.45

Tested by

no test coverage detected