xlm.commands.lightning_eval
instantiate_model(cfg, datamodule, tokenizer)
Instantiate and load a model for evaluation.
Supports two modes
- Load a model from full training checkpoint using
lightning_module.load_from_checkpoint(cfg.eval.checkpoint_path) - Load a model from model only checkpoint using
lightning_module.model.load_state_dict(torch.load(cfg.eval.model_only_checkpoint_path))
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
DictConfig
|
Hydra config |
required |
datamodule
|
Any
|
Datamodule |
required |
tokenizer
|
Any
|
Tokenizer |
required |
Returns:
| Type | Description |
|---|---|
Harness
|
Tuple of (lightning_module, ckpt_path) where ckpt_path is the full checkpoint path |
Optional[str]
|
(or None if using model-only checkpoint) |