load method

Future<void> load(
  1. String modelId, [
  2. DiffusionConfiguration? config
])

Load a diffusion model by registry ID through commons lifecycle routing.

Reuses the canonical RunAnywhere.loadModel path with the image-generation component, exactly like every other modality (VLM/embeddings/…).

Implementation

Future<void> load(String modelId, [DiffusionConfiguration? config]) async {
  _ensureInitialized();
  _ensureApplePlatform();

  final result = await RunAnywhereModelLifecycle.shared.load(
    model_pb.ModelLoadRequest(
      modelId: modelId,
      category: _diffusionCategory,
      forceReload: true,
      validateAvailability: true,
    ),
  );
  if (!result.success) {
    throw SDKException.modelLoadFailed(
      modelId,
      result.errorMessage.isNotEmpty
          ? result.errorMessage
          : 'Diffusion lifecycle load failed',
    );
  }
}