pub struct GraphFoundationModel {
pub config: FoundationModelConfig,
pub encoder_layers: Vec<String>,
pub pretraining_head: PretrainingHead,
pub task_heads: HashMap<String, String>,
pub tokenizer: GraphTokenizer,
pub parameters: FoundationModelParameters,
}Expand description
Graph foundation model architecture
Fields§
§config: FoundationModelConfigModel configuration
encoder_layers: Vec<String>Encoder layers (stored as indices/configs instead of trait objects for clonability)
pretraining_head: PretrainingHeadPre-training head
task_heads: HashMap<String, String>Fine-tuning heads (stored as type names for reconstruction)
tokenizer: GraphTokenizerTokenizer for graph elements
parameters: FoundationModelParametersModel parameters
Implementations§
Source§impl GraphFoundationModel
impl GraphFoundationModel
Sourcepub fn new(config: FoundationModelConfig) -> Result<Self, FoundationModelError>
pub fn new(config: FoundationModelConfig) -> Result<Self, FoundationModelError>
Create a new foundation model
Sourcepub fn pretrain(
&mut self,
graphs: &[GraphData],
num_epochs: usize,
) -> Result<PretrainingStats, FoundationModelError>
pub fn pretrain( &mut self, graphs: &[GraphData], num_epochs: usize, ) -> Result<PretrainingStats, FoundationModelError>
Pre-train the foundation model
Sourcepub fn finetune(
&mut self,
task_name: &str,
train_data: &[(GraphData, Tensor)],
val_data: &[(GraphData, Tensor)],
task_config: TaskConfig,
) -> Result<FinetuningStats, FoundationModelError>
pub fn finetune( &mut self, task_name: &str, train_data: &[(GraphData, Tensor)], val_data: &[(GraphData, Tensor)], task_config: TaskConfig, ) -> Result<FinetuningStats, FoundationModelError>
Fine-tune on downstream task
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GraphFoundationModel
impl RefUnwindSafe for GraphFoundationModel
impl Send for GraphFoundationModel
impl Sync for GraphFoundationModel
impl Unpin for GraphFoundationModel
impl UnsafeUnpin for GraphFoundationModel
impl UnwindSafe for GraphFoundationModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more