Model API¶
Complete API reference for model operations.
Model Class¶
class Model:
def __init__(self, config)
Class Methods¶
from_pretrained(model_name)¶
Load pre-trained model.
model = Model.from_pretrained("bert-base")
Instance Methods¶
forward(x)¶
Forward pass.
output = model.forward(input_tensor)
save(path)¶
Save model.
model.save("./model.pt")
load_state(state_dict)¶
Load model state.
model.load_state(state_dict)
freeze_encoder()¶
Freeze encoder layers.
model.freeze_encoder()
finetune_head(num_classes)¶
Fine-tune classification head.
model.finetune_head(num_classes=10)
get_layer(name)¶
Get specific layer.
layer = model.get_layer("layer1")
Model Properties¶
| Property | Type | Description |
|---|---|---|
| config | dict | Model configuration |
| device | str | Device location |
| dtype | dtype | Data type |
Model Types¶
- Transformer
- CNN
- RNN
- LSTM
- GRU
- GNN