File size: 850 Bytes
f5eae9c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Minimal adapter example; no vision checkpoint is bundled with CORTEX AI.

Replace DummyVisionEncoder with a separately approved image encoder and provide
its processor. This example validates the interface without claiming model
level image understanding.
"""

import torch
from torch import nn

from cortex_ai.vision import VisionConfig, build_vision_adapter


class DummyVisionEncoder(nn.Module):
    def forward(self, images):
        return torch.zeros(images.shape[0], 2, 4)


if __name__ == "__main__":
    config = VisionConfig(vision_hidden_size=4, cortex_hidden_size=7168)
    adapter = build_vision_adapter(config, DummyVisionEncoder())
    result = adapter.prepare_multimodal_input(torch.zeros(1, 3, 224, 224))
    print(result.image_embeddings.shape)
    print("Vision adapter path executed; CORTEX core fusion remains experimental.")