sybil / configuration_sybil.py
Aakash-Tripathi's picture
Upload folder using huggingface_hub
1206896 verified
"""Sybil model configuration"""
from transformers import PretrainedConfig
from typing import Optional, List, Dict
import json
class SybilConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SybilForRiskPrediction`].
It is used to instantiate a Sybil model according to the specified arguments, defining the model architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs.
Args:
hidden_dim (`int`, *optional*, defaults to 512):
Dimensionality of the hidden representations.
dropout (`float`, *optional*, defaults to 0.0):
The dropout probability for all fully connected layers.
max_followup (`int`, *optional*, defaults to 6):
Maximum number of years for risk prediction.
num_images (`int`, *optional*, defaults to 208):
Number of CT scan slices to process.
img_size (`List[int]`, *optional*, defaults to `[512, 512]`):
Size of input images after preprocessing.
voxel_spacing (`List[float]`, *optional*, defaults to `[0.703125, 0.703125, 2.5]`):
Target voxel spacing for CT scans (row, column, slice thickness).
censoring_distribution (`str`, *optional*, defaults to "weibull"):
Distribution used for censoring in survival analysis.
ensemble_size (`int`, *optional*, defaults to 5):
Number of models in the ensemble.
calibrator_data (`Dict`, *optional*):
Calibration data for risk score adjustment.
"""
model_type = "sybil"
def __init__(
self,
hidden_dim: int = 512,
dropout: float = 0.0,
max_followup: int = 6,
num_images: int = 208,
img_size: List[int] = None,
voxel_spacing: List[float] = None,
censoring_distribution: str = "weibull",
ensemble_size: int = 5,
calibrator_data: Optional[Dict] = None,
initializer_range: float = 0.02,
**kwargs
):
super().__init__(**kwargs)
self.hidden_dim = hidden_dim
self.dropout = dropout
self.max_followup = max_followup
self.num_images = num_images
self.img_size = img_size if img_size is not None else [512, 512]
self.voxel_spacing = voxel_spacing if voxel_spacing is not None else [0.703125, 0.703125, 2.5]
self.censoring_distribution = censoring_distribution
self.ensemble_size = ensemble_size
self.calibrator_data = calibrator_data
self.initializer_range = initializer_range