xlm.commands.scaffold_model
Script to scaffold a new external language model for the XLM framework.
Usage: xlm-scaffold
This script creates a complete external model structure with: - Python package with skeleton implementations - Configuration files for all necessary components - Documentation and examples
validate_model_name(name)
Validate and normalize model name.
create_template_context(model_name)
Create template context with all necessary variables.
generate_types_file(model_dir, context)
Generate the types_{model_name}.py file with TypedDict definitions.
generate_model_file(model_dir, context)
Generate the model_{model_name}.py file with the neural network implementation.
generate_loss_file(model_dir, context)
Generate the loss_{model_name}.py file with loss computation.
generate_predictor_file(model_dir, context)
Generate the predictor_{model_name}.py file with inference logic.
generate_datamodule_file(model_dir, context)
Generate the datamodule_
generate_metrics_file(model_dir, context)
Generate the metrics_{model_name}.py file with metric computation logic.
generate_init_file(model_dir, context, is_core=False)
Generate the init.py file.
generate_config_files(config_dir, context, is_core=False)
Generate all configuration files.
generate_setup_file(model_dir, context)
Generate setup.py for the external model.
generate_documentation(model_dir, context)
Generate README and documentation.
update_xlm_models_file(model_name, xlm_models_path=Path('xlm_models.json'))
Add the new model to the xlm_models.json file.