View in English

  • Apple Developer
    • 今すぐ始める

    「今すぐ始める」を詳しく見る

    • 概要
    • 学ぶ
    • Apple Developer Program

    最新情報

    • 最新ニュース
    • Hello Developer
    • プラットフォーム

    プラットフォームを詳しく見る

    • Appleプラットフォーム
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    特集

    • デザイン
    • 配信
    • ゲーム
    • アクセサリ
    • Web
    • Home
    • CarPlay
    • テクノロジー

    テクノロジーを詳しく見る

    • 概要
    • Xcode
    • Swift
    • SwiftUI

    特集

    • アクセシビリティ
    • App Intent
    • Apple Intelligence
    • ゲーム
    • 機械学習とAI
    • セキュリティ
    • Xcode Cloud
    • コミュニティ

    コミュニティを詳しく見る

    • 概要
    • 「Appleに相談」イベント
    • コミュニティによるイベント
    • デベロッパフォーラム
    • オープンソース

    特集

    • WWDC
    • Swift Student Challenge
    • デベロッパストーリー
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Center
    • ドキュメント

    ドキュメントを詳しく見る

    • ドキュメントライブラリ
    • テクノロジー概要
    • サンプルコード
    • ヒューマンインターフェイスガイドライン
    • ビデオ

    リリースノート

    • 注目のアップデート
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • ダウンロード

    ダウンロードを詳しく見る

    • すべてのダウンロード
    • オペレーティングシステム
    • アプリ
    • デザインリソース

    特集

    • Xcode
    • TestFlight
    • フォント
    • SF Symbols
    • Icon Composer
    • サポート

    サポートを詳しく見る

    • 概要
    • ヘルプガイド
    • デベロッパフォーラム
    • フィードバックアシスタント
    • お問い合わせ

    特集

    • アカウントヘルプ
    • App Reviewガイドライン
    • App Store Connectヘルプ
    • 近日導入予定の要件
    • 契約およびガイドライン
    • システムステータス
  • クイックリンク

    • イベント
    • ニュース
    • Forum
    • サンプルコード
    • ビデオ
 

ビデオ

メニューを開く メニューを閉じる
  • コレクション
  • すべてのビデオ
  • 利用方法

その他のビデオ

  • 概要
  • Summary
  • コード
  • Core AIモデルのオーサリングと最適化の詳細

    新しいCore AIフレームワークを利用した、Appleシリコン向けの完全なカスタムモデルのデプロイワークフローについて詳しく解説します。カスタムMetalカーネルを活用するモデルオーサリングのパワフルな手法や、プラットフォームに応じた圧縮の戦略を学びましょう。新しいCore AI Debuggerでは詳細な内在的分析を実行するほか、AI支援ワークフローが初期の構想からデバイス上での最適化された実行までのプロセス全体をガイドします。

    関連する章

    • 0:00 - Introduction
    • 1:49 - Models and skills
    • 3:27 - Python workflow
    • 5:54 - Model optimization
    • 10:40 - Core AI Debugger
    • 19:27 - Advanced authoring
    • 20:43 - Custom Metal kernels
    • 23:01 - Model re-authoring
    • 28:46 - Next steps

    リソース

    • Core AI PyTorch Extensions
    • Core AI Python
    • Core AI Optimization
    • Inspecting, debugging, and profiling Core AI models
    • Inspecting Core AI models with Core AI Debugger
    • Core AI
      • HDビデオ
      • SDビデオ

    関連ビデオ

    WWDC26

    • MLXによる分散推論と分散トレーニング
    • MLXを利用したMac上でのローカルのエージェントAIの実行
    • MLXを活用したSwiftでの数値計算
  • このビデオを検索
    • 3:27 - Define and export a PyTorch model

      import torch
      import torch.nn as nn
      
      # Define a simple model
      class MLP(nn.Module):
          def __init__(self):
              super().__init__()
              self.fc1 = nn.Linear(256, 512)
              self.fc2 = nn.Linear(512, 10)
      
          def forward(self, x):
              return self.fc2(torch.relu(self.fc1(x)))
      
      # Export with torch.export
      model = MLP().eval()
      example_input = (torch.randn(1, 256),)
      exported_program = torch.export.export(model, example_input)
    • 4:02 - Convert, optimize and run inference with Core AI

      import coreai
      import coreai_torch
      from coreai.runtime import NDArray
      
      # Convert to Core AI
      converter = coreai_torch.TorchConverter()
      converter.add_exported_program(
          exported_program,
          input_names=["features"], output_names=["logits"])
      core_ai_program = converter.to_coreai()
      
      # Optimize and save to .aimodel
      core_ai_program.optimize()
      asset = core_ai_program.save_asset("mlp.aimodel")
      
      # Run inference
      specialized_model = await AIModel.load("mlp.aimodel")
      specialized_function = specialized_model.load_function("main")
      result = await specialized_function({"features": NDArray(example[0].numpy())})
    • 21:12 - Define a SiLU Metal kernel with PyTorch reference

      import torch
      from coreai_torch.dsl import TorchMetalKernel, MetalParameter
      
      def silu_torch(x):
          return x * torch.sigmoid(x)
      
      SILU_MSL = """
      float val = float(x[gid]);
      float sig = 1.0f / (1.0f + exp(-val));
      y[gid] = TYPE(val * sig);
      """
      
      silu_kernel = TorchMetalKernel(
          name="fused_silu",
          input_names=["x"],
          result_names=["y"],
          src=SILU_MSL,
          torch_defn=silu_torch,
          metal_params=[MetalParameter("gid", "uint", "thread_position_in_grid")],
          template_dtypes={"x": "TYPE"},
      )
    • 22:09 - Use a custom Metal kernel and convert with TorchConverter

      class MyModel(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.linear = torch.nn.Linear(256, 256)
      
          def forward(self, x):
              h = self.linear(x)
              n = h.numel()
              return silu_kernel(
                  h,
                  threads_per_grid_size=(n, 1, 1),
                  threads_per_thread_group=(min(n, 256), 1, 1),
                  result_shapes=[h.shape],
              )
      
      exported_program = torch.export.export(MyModel(), (torch.randn(1, 256),))
      
      converter = coreai_torch.TorchConverter()
      converter.register_custom_kernels([silu_kernel])
      converter.add_exported_program(exported_program,
                                     input_names=["x"], output_names=["y"])
      deployable = converter.to_coreai()  # MSL integrated into asset
    • 0:00 - Introduction
    • Overview of Core AI's complete Python ecosystem for model deployment on Apple Silicon — covering the model lifecycle from optimization and conversion through debugging and app integration.

    • 1:49 - Models and skills
    • Introduction to the coreai-models open-source repository — ready-to-go model architectures, reusable components, and agent skills you can install into your coding assistant to leverage Core AI best practices from day one.

    • 3:27 - Python workflow
    • How to convert a PyTorch model to Core AI using coreai-torch — exporting a program with torch.export, running TorchConverter with input/output names, saving as an .aimodel asset, and performing inference from Python with numpy inputs.

    • 5:54 - Model optimization
    • How to compress models using coreai-opt's config-driven optimization library — demonstrated on SAM3 (850M parameters) using int4 per-channel symmetric quantization presets, reducing the model from 3GB to 430MB, and understanding the trade-offs of aggressive uniform compression.

    • 10:40 - Core AI Debugger
    • Introduction to Core AI Debugger — a standalone app for inspecting models on Apple platforms. Covers the navigator (PyTorch module hierarchy), structure viewer (operation graph), source viewer (original Python code), inspector (tensor details), and how to run a model on-device to inspect intermediate tensor outputs.

    • 19:27 - Advanced authoring
    • How advanced model authoring goes beyond end-to-end conversion — fusing multiple operations into a single kernel dispatch, and leveraging Core AI's pre-packaged fast kernels for heavy operations like Scaled Dot Product Attention.

    • 20:43 - Custom Metal kernels
    • How to embed custom Metal Shading Language kernels directly into a Core AI model asset — writing a PyTorch reference function alongside an MSL kernel, registering a TorchMetalKernel with TorchConverter, and shipping the kernel bundled inside the .aimodel file.

    • 23:01 - Model re-authoring
    • How to re-author a PyTorch model from scratch for power-efficient execution on iOS — demonstrated on SAM3 by splitting into three independent functions (image_encode, text_encode, detect), using convolutional projections and channels-first layouts, applying 4-bit palettization to the encoders, and achieving faster second inference by reusing cached image embeddings.

    • 28:46 - Next steps
    • Summary of the Core AI Python toolchain: convert with coreai-torch, optimize with coreai-opt, debug with Core AI Debugger, build on coreai-models examples, and use Core AI Skills in your coding agent.

Developer Footer

  • ビデオ
  • WWDC26
  • Core AIモデルのオーサリングと最適化の詳細
  • メニューを開く メニューを閉じる
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    メニューを開く メニューを閉じる
    • アクセシビリティ
    • アクセサリ
    • Apple Intelligence
    • App Extension
    • App Store
    • オーディオとビデオ(英語)
    • 拡張現実
    • デザイン
    • 配信
    • 教育
    • フォント(英語)
    • ゲーム
    • ヘルスケアとフィットネス
    • アプリ内課金
    • ローカリゼーション
    • マップと位置情報
    • 機械学習とAI
    • オープンソース(英語)
    • セキュリティ
    • SafariとWeb(英語)
    メニューを開く メニューを閉じる
    • 英語ドキュメント(完全版)
    • 日本語ドキュメント(一部トピック)
    • チュートリアル
    • ダウンロード
    • フォーラム(英語)
    • ビデオ
    Open Menu Close Menu
    • サポートドキュメント
    • お問い合わせ
    • バグ報告
    • システム状況(英語)
    メニューを開く メニューを閉じる
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles(英語)
    • フィードバックアシスタント
    メニューを開く メニューを閉じる
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program(英語)
    • Mini Apps Partner Program
    • News Partner Program(英語)
    • Video Partner Program(英語)
    • セキュリティ報奨金プログラム(英語)
    • Security Research Device Program(英語)
    Open Menu Close Menu
    • Appleに相談
    • Apple Developer Center
    • App Store Awards(英語)
    • Apple Design Awards
    • Apple Developer Academy(英語)
    • WWDC
    最新ニュースを読む。
    Apple Developerアプリを入手する。
    Copyright © 2026 Apple Inc. All rights reserved.
    利用規約 プライバシーポリシー 契約とガイドライン