conversion#
External draft conversion/restore utilities.
Functions
Convert a pretrained causal LM into a trainable external draft as per config. |
|
Function for restoring a previously converted model to an external draft model. |
- convert_to_external_draft_model(model, config)#
Convert a pretrained causal LM into a trainable external draft as per config.
Note that, unlike the other speculative modes,
modelhere is the draft rather than the base model. Nothing is grafted onto a target; the draft keeps its own embeddings and lm_head.- Parameters:
model (Module)
config (ExternalDraftConfig)
- Return type:
tuple[Module, dict[str, Any]]
- restore_external_draft_model(model, config, metadata)#
Function for restoring a previously converted model to an external draft model.
- Parameters:
model (Module)
config (ExternalDraftConfig)
metadata (dict[str, Any])
- Return type:
Module