Networks
Reference information for the language model Networks
API.
eva.language.models.modules.TextModule
Bases: ModelModule
Text-based LLM module for inference.
Uses LLM wrappers for text generation and supports evaluation using configurable metrics and post-processing transforms.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Module
|
An LLM wrapper (PyTorch-compatible) for text generation. |
required |
prompt |
str
|
The prompt to use for generating text. |
required |
metrics |
MetricsSchema | None
|
Metrics schema for evaluation. |
None
|
postprocess |
BatchPostProcess | None
|
A helper function to post-process model outputs before evaluation. |
None
|
Source code in src/eva/language/models/modules/text.py
forward
Generates text responses for a batch of prompts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompts |
List[str]
|
List of input texts to generate responses. |
required |
args |
Any
|
Additional arguments. |
()
|
kwargs |
Any
|
Additional keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
List[str]
|
List of generated responses. |
Source code in src/eva/language/models/modules/text.py
validation_step
Validation step that runs batch inference and evaluates metrics.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
batch |
TEXT_BATCH
|
An input batch. |
required |
args |
Any
|
Additional arguments. |
()
|
kwargs |
Any
|
Additional keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
STEP_OUTPUT
|
Dictionary with predictions, ground truth, and evaluation metrics. |