ShowO<T>

Models & Types · AiDotNet.VisionLanguage.Unified

Show-o: single transformer for unified understanding and generation.

Inheritance: NeuralNetworkBase<T> → VisionLanguageModelBase<T> → ShowO<T>

Implements: IUnifiedVisionModel<T>

For Beginners

Show-o is a unified transformer model that handles both multimodal understanding and image generation. Default values follow the original paper settings.

How It Works

Show-o (NUS, 2024) uses a single transformer to unify multimodal understanding and generation. It combines autoregressive next-token prediction for text with discrete diffusion for image generation within the same model, switching between generation modes based on the output modality while sharing all transformer parameters.

References:

  • Paper: “Show-o: One Single Transformer to Unify Multimodal Understanding and Generation” (NUS, 2024)

Example

// Create a Show-o model for unified multimodal understanding and generation
// using a single transformer architecture for both tasks
var architecture = new NeuralNetworkArchitecture<double>(
    inputType: InputType.TwoDimensional,
    taskType: NeuralNetworkTaskType.ImageClassification,
    inputHeight: 224, inputWidth: 224, inputDepth: 3, outputSize: 512);
            
// ONNX inference mode with pre-trained model
var model = new ShowO<double>(architecture, "showo.onnx");
            
// Training mode with native layers
var trainModel = new ShowO<double>(architecture, new ShowOOptions());

Constructors

Constructor Summary
ShowO(NeuralNetworkArchitecture<T> architecture, ShowOOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer)
ShowO(NeuralNetworkArchitecture<T> architecture, string modelPath, ShowOOptions options)

Properties

Property Summary
bool SupportsGeneration { get; }
int DecoderEmbeddingDim { get; }
int EmbeddingDimension { get; }
int MaxGenerationLength { get; }

Methods

Method Summary
ModelMetadata<T> GetModelMetadata()
Tensor<T> EncodeImage(Tensor<T> image)
Tensor<T> GenerateFromImage(Tensor<T> image, string prompt) Generates text from image using Show-o’s unified omni-attention transformer.
Tensor<T> GenerateImage(string textDescription) Generates an image from text using Show-o’s discrete diffusion in token space.