# 策展 · X (Twitter) 🔥🔥🔥🔥🔥

> 作者：Google Gemma (@googlegemma) · 平台：X (Twitter) · 日期：2026-05-05

> 原始來源：https://x.com/googlegemma/status/2051350655135297564

## 中文摘要

Google「Gemma 4」即將在 React Native 行動裝置端完全本地運行。

Google「Gemma」官方宣布，行動開發者社群透過「react-native-executorch」解鎖全新建置方式，即將支援「Gemma 4」模型在裝置上完全運行，由「Software Mansion」團隊打造此整合，連結至 GitHub 專案（https://github.com/software-mansion/react-native-executorch）。

**專案概述**  
「React Native ExecuTorch」提供宣告式方式，讓 React Native 使用者透過「ExecuTorch」在裝置上運行人工智慧模型，支援多種大型語言模型（LLM）、電腦視覺模型等。「ExecuTorch」由 Meta 開發，專為手機或微控制器等裝置設計。此橋接解決 React Native 與原生平台間的落差，讓開發者無需深入原生程式撰寫或機器學習專業，即可高效運行本地 AI 模型。專案提供 npm 套件（最新版與 nightly 版），並通過 CI 測試，文件多語言支援（EN、ES、FR、CN、PT、IN）。

**支援版本與架構要求**  
僅支援「New React Native architecture」，最低版本為：  
- iOS 17.0  
- Android 13  
- React Native 相容性參考文件表格（https://docs.swmansion.com/react-native-executorch/docs/next/other/compatibility）。  
運行 LLM 需大量 RAM，模擬器崩潰時須增加分配 RAM。

**實際應用案例**  
驅動「Private Mind」應用（https://privatemind.swmansion.com/），這是注重隱私的行動 AI App，已上架 App Store（https://apps.apple.com/gb/app/private-mind/id6746713439）與 Google Play（https://play.google.com/store/apps/details?id=com.swmansion.privatemind），展示真實世界部署。

**快速入門：運行 LFM2.5**  
三步驟啟用 AI 文字生成：  
**步驟一：安裝**  
```bash  
yarn add react-native-executorch  
```  
Expo 專案加：`yarn add react-native-executorch-expo-resource-fetcher expo-file-system expo-asset`；  
Bare React Native 加：`yarn add react-native-executorch-bare-resource-fetcher @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader`；  
平台專屬：`yarn < ios | android >`。  

**步驟二：設定與初始化**  
在元件檔案加入：  
```tsx  
import {  
  useLLM,  
  LFM2_5_1_2B_INSTRUCT,  
  Message,  
  initExecutorch,  
} from 'react-native-executorch';  
import { ExpoResourceFetcher } from 'react-native-executorch-expo-resource-fetcher';  

initExecutorch({  
  resourceFetcher: ExpoResourceFetcher,  
});  

function MyComponent() {  
  const llm = useLLM({ model: LFM2_5_1_2B_INSTRUCT });  
  // ...  
}  
```  

**步驟三：執行模型**  
```tsx  
const handleGenerate = async () => {  
  const chat: Message[] = [  
    { role: 'system', content: 'You are a helpful assistant' },  
    { role: 'user', content: 'What is the meaning of life?' }  
  ];  
  await llm.generate(chat);  
  console.log('LFM2.5 says:', llm.response);  
};  
```  
此流程展示聊天完成（chat completion）功能。

**示範應用**  
專案內含多個範例 App（https://github.com/software-mansion/react-native-executorch/tree/main/apps），執行方式：進入目錄後 `yarn && yarn < ios | android >`：  
- `llm`：展示 LLM 聊天應用。  
- `speech`：語音轉文字與文字轉語音任務。  
- `computer-vision`：電腦視覺相關任務。  
- `text-embeddings`：計算文字嵌入，用於語意搜尋。  
- `bare-rn`：無 Expo 的 Bare React Native LLM 聊天範例。

**現成模型與自訂支援**  
庫內內建多款即用 AI 模型，完整清單見文件（https://docs.swmansion.com/react-native-executorch）。自訂模型需匯出為 `.pte` 格式，參考 PyTorch「Python API」（https://docs.pytorch.org/executorch/stable/using-executorch-export.html）與「optimum-executorch」文件（https://github.com/huggingface/optimum-executorch?tab=readme-ov-file#option-2-export-and-load-separately）。HuggingFace 頁面（https://huggingface.co/software-mansion）提供探索模型。

**文件與社群資源**  
完整文件：https://docs.swmansion.com/react-native-executorch。  
- GitHub 貢獻者、星數徽章。  
- Discord 社群（https://discord.gg/ZGqqY55qkP）。  
- 聘請團隊（https://swmansion.com/contact）。  
授權為 MIT License（./LICENSE）。未來計劃見 milestones（https://github.com/software-mansion/react-native-executorch/milestones）。

**開發團隊背景**  
「Software Mansion」自 2012 年起專注網頁與行動 App 開發，為 React Native 核心貢獻者，擅長解決 React Native 難題，提供客製服務（https://swmansion.com）。

此整合標誌行動裝置端 AI 運行進入新階段，Google「Gemma」與 React Native 社群合作，強調本地執行、無雲端依賴的隱私優勢，由「Software Mansion」主導，快速上手門檻低，涵蓋 LLM 到電腦視覺等多模態，預計加速隱私優先 AI App 開發浪潮。

## 標籤

開源專案, 新產品, Android, iOS, React, Google, Gemma, Software Mansion
