Deploy
Model deployment pipeline for Frankenstein Transformer.
Converts trained checkpoints to optimized, quantized deployable artifacts. Supports both BitNet-quantized and standard FP32 deployment formats, with optional post-deployment validation.
- class src.deploy.deploy.ModelDeployer(config: FrankensteinModelConfig, device: str = 'cpu')[source]
Bases:
objectHandles conversion of trained models to deployment-ready format.
Loads a training checkpoint, initializes the model, and exports it in either quantized (BitNet ternary) or standard FP32 format, along with config JSON and deployment metadata.
- config
FrankensteinModelConfigfor the model.
- device
PyTorch device for deployment conversion.
- model
The loaded
FrankensteinEncoderinstance.
- __init__(config: FrankensteinModelConfig, device: str = 'cpu')[source]
Initialize the deployer.
- Parameters:
config – Model configuration.
device – PyTorch device string for conversion.
- convert_to_deployment(output_dir: str, save_format: str = 'quantized', bake_bitnet: bool = True) None[source]
Convert model to deployment format.
- Parameters:
output_dir – Directory to save deployment artifacts
save_format – ‘quantized’ or ‘standard’
bake_bitnet – When
save_format='quantized'and BitNet is enabled, bake BitLinear weights to faithful ternary values before packing (defaultTrue). No effect otherwise.