Class MultiModalTeacherModel<T>
- Namespace
- AiDotNet.KnowledgeDistillation.Teachers
- Assembly
- AiDotNet.dll
Multi-modal teacher that combines multiple input modalities (vision, text, audio).
public class MultiModalTeacherModel<T> : TeacherModelBase<Vector<T>, Vector<T>, T>, ITeacherModel<Vector<T>, Vector<T>>, IJitCompilable<T>
Type Parameters
T
- Inheritance
-
MultiModalTeacherModel<T>
- Implements
- Inherited Members
Constructors
MultiModalTeacherModel(ITeacherModel<Vector<T>, Vector<T>>[], double[]?)
public MultiModalTeacherModel(ITeacherModel<Vector<T>, Vector<T>>[] modalityTeachers, double[]? modalityWeights = null)
Parameters
modalityTeachersITeacherModel<Vector<T>, Vector<T>>[]modalityWeightsdouble[]
Properties
OutputDimension
Gets the number of output dimensions (e.g., number of classes for classification).
public override int OutputDimension { get; }
Property Value
Remarks
For Implementers: Return the size of the output vector. For example, a 10-class classifier should return 10.
SupportsJitCompilation
Gets whether this teacher supports JIT compilation.
public override bool SupportsJitCompilation { get; }
Property Value
- bool
Returns
trueif all modality teachers support JIT compilation; otherwise,false.
Remarks
For Beginners: Multi-modal JIT compilation is supported when all modality teachers implement IJitCompilable and support JIT. The combined computation graph weights and sums each modality's contribution.
Methods
ExportComputationGraph(List<ComputationNode<T>>)
Exports the multi-modal computation graph for JIT compilation.
public override ComputationNode<T> ExportComputationGraph(List<ComputationNode<T>> inputNodes)
Parameters
inputNodesList<ComputationNode<T>>List to populate with input computation nodes.
Returns
- ComputationNode<T>
The output computation node representing the weighted multi-modal output.
Remarks
The multi-modal graph combines each modality teacher's computation graph using weighted sum: output = w1 * modality1_output + w2 * modality2_output + ... + wN * modalityN_output
Note: All modality teachers must support JIT compilation. The combined graph enables optimized inference across all modalities in a single execution.
Exceptions
- NotSupportedException
Thrown when any modality teacher does not support JIT.
GetLogits(Vector<T>)
Gets combined logits from all modality teachers.
public override Vector<T> GetLogits(Vector<T> input)
Parameters
inputVector<T>Input data.
Returns
- Vector<T>
Combined logits from all modalities.
Remarks
Architecture Note: Returns raw combined logits. Temperature scaling and softmax are handled by distillation strategies, not by the teacher model.