vllm_backend
vllm_backend
¶
vLLM-based generation backend for tabular data synthesis.
Classes:
| Name | Description |
|---|---|
VllmBackend |
Generation backend using vLLM for high-throughput inference. |
VllmBackend(config, model_metadata, workdir, **kwargs)
¶
Bases: GeneratorBackend
Generation backend using vLLM for high-throughput inference.
Loads the base model with a LoRA adapter via vLLM and generates synthetic records in batches. Supports optional structured generation (regex or JSON schema) to constrain outputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SafeSynthesizerParameters
|
Pipeline configuration. |
required |
model_metadata
|
ModelMetadata
|
Model metadata (prompt template, adapter path, sequence length, etc.). |
required |
workdir
|
Workdir
|
Working directory containing the adapter and schema. |
required |
**kwargs
|
Additional options. |
{}
|
Methods:
| Name | Description |
|---|---|
teardown |
Release GPU memory and distributed resources. Idempotent -- safe to call multiple times. |
initialize |
Initialize and load the model into memory. |
prepare_params |
Parse parameters and configure the generation method. |
generate |
Generate synthetic tabular data in batches until the target count is reached. |
Source code in src/nemo_safe_synthesizer/generation/vllm_backend.py
teardown()
¶
Release GPU memory and distributed resources. Idempotent -- safe to call multiple times.
Source code in src/nemo_safe_synthesizer/generation/vllm_backend.py
initialize(**kwargs)
¶
Initialize and load the model into memory.
Source code in src/nemo_safe_synthesizer/generation/vllm_backend.py
prepare_params(**kwargs)
¶
Parse parameters and configure the generation method.
Parses a dictionary of parameters into SamplingParameters, applying necessary transformations from our API to vLLM's API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Sampling parameters to configure. |
{}
|
Source code in src/nemo_safe_synthesizer/generation/vllm_backend.py
generate(data_actions_fn=None)
¶
Generate synthetic tabular data in batches until the target count is reached.
Iterates over generation batches, applying the processor to each
LLM output, until the configured num_records target is met or
a stopping condition fires.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_actions_fn
|
DataActionsFn | None
|
Optional post-processing / validation function applied to each batch of generated records. |
None
|
Returns:
| Type | Description |
|---|---|
GenerateJobResults
|
Results containing the generated DataFrame and statistics. |
Source code in src/nemo_safe_synthesizer/generation/vllm_backend.py
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | |