Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ yarn add @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-down
yarn < ios | android >
```

> npm and pnpm work too — use `npm install` or `pnpm add` for the packages, and `npm run <ios|android>` / `pnpm <ios|android>` for the run step.
### :two: Setup & Initialization

Add this to your component file:
Expand Down
114 changes: 87 additions & 27 deletions docs/docs/01-fundamentals/01-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,45 +38,85 @@ For supported React Native and Expo versions, see the [Compatibility table](../0

## Installation

Installation is pretty straightforward, use your package manager of choice to install the package and some peer dependencies required to streamline model downloads. If you want to implement your custom model fetching logic, see [this document](../08-resource-fetcher/02-custom-adapter.md).
Installation takes two steps: install the core package, then install a resource fetcher adapter that matches your project type. If you want to implement your own model fetching logic instead, see [this document](../08-resource-fetcher/02-custom-adapter.md).

<Tabs>
<TabItem value="npm" label="NPM">
### 1. Install the core package

<Tabs groupId="package-manager">
<TabItem value="npm" label="npm">

```bash
npm install react-native-executorch
# For Expo projects, you need to install expo resource fetcher
npm install react-native-executorch-expo-resource-fetcher
npm install expo-file-system expo-asset
# For bare React Native projects, you need to install bare resource fetcher
npm install react-native-executorch-bare-resource-fetcher
npm install @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader
```

</TabItem>
<TabItem value="pnpm" label="PNPM">
<TabItem value="pnpm" label="pnpm">

```bash
pnpm install react-native-executorch
# For Expo projects, you need to install expo resource fetcher
pnpm install react-native-executorch-expo-resource-fetcher
pnpm install expo-file-system expo-asset
# For bare React Native projects, you need to install bare resource fetcher
pnpm install react-native-executorch-bare-resource-fetcher
pnpm install @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader
pnpm add react-native-executorch
```

</TabItem>
<TabItem value="yarn" label="YARN">
<TabItem value="yarn" label="yarn">

```bash
yarn add react-native-executorch
# For Expo projects, you need to install expo resource fetcher
yarn add react-native-executorch-expo-resource-fetcher
yarn add expo-file-system expo-asset
# For bare React Native projects, you need to install bare resource fetcher
yarn add react-native-executorch-bare-resource-fetcher
yarn add @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader
```

</TabItem>
</Tabs>

### 2. Install a resource fetcher

Pick the adapter that matches your project. We recommend the Expo adapter when your app uses Expo; use the bare adapter for projects without Expo.

#### Expo projects

<Tabs groupId="package-manager">
<TabItem value="npm" label="npm">

```bash
npm install react-native-executorch-expo-resource-fetcher expo-file-system expo-asset
```

</TabItem>
<TabItem value="pnpm" label="pnpm">

```bash
pnpm add react-native-executorch-expo-resource-fetcher expo-file-system expo-asset
```

</TabItem>
<TabItem value="yarn" label="yarn">

```bash
yarn add react-native-executorch-expo-resource-fetcher expo-file-system expo-asset
```

</TabItem>
</Tabs>

#### Bare React Native projects

<Tabs groupId="package-manager">
<TabItem value="npm" label="npm">

```bash
npm install react-native-executorch-bare-resource-fetcher @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader
```

</TabItem>
<TabItem value="pnpm" label="pnpm">

```bash
pnpm add react-native-executorch-bare-resource-fetcher @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader
```

</TabItem>
<TabItem value="yarn" label="yarn">

```bash
yarn add react-native-executorch-bare-resource-fetcher @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader
```

</TabItem>
Expand Down Expand Up @@ -120,9 +160,29 @@ Because we are using ExecuTorch under the hood, you won't be able to build iOS a

Running the app with the library:

```bash
yarn <ios | android> -d
```
<Tabs groupId="package-manager">
<TabItem value="npm" label="npm">

```bash
npm run <ios | android> -- -d
```

</TabItem>
<TabItem value="pnpm" label="pnpm">

```bash
pnpm <ios | android> -d
```

</TabItem>
<TabItem value="yarn" label="yarn">

```bash
yarn <ios | android> -d
```

</TabItem>
</Tabs>

## Supporting new models in React Native ExecuTorch

Expand Down
57 changes: 49 additions & 8 deletions docs/docs/01-fundamentals/02-loading-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
title: Loading Models
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

There are three different methods available for loading model files, depending on their size and location.

## Prerequisites
Expand All @@ -10,10 +13,29 @@ In our library, you can use two different resource fetching mechanisms. One is i

To use the Expo adapter, please add these libraries:

```bash
yarn add react-native-executorch-expo-resource-fetcher
yarn add expo-file-system expo-asset
```
<Tabs groupId="package-manager">
<TabItem value="npm" label="npm">

```bash
npm install react-native-executorch-expo-resource-fetcher expo-file-system expo-asset
```

</TabItem>
<TabItem value="pnpm" label="pnpm">

```bash
pnpm add react-native-executorch-expo-resource-fetcher expo-file-system expo-asset
```

</TabItem>
<TabItem value="yarn" label="yarn">

```bash
yarn add react-native-executorch-expo-resource-fetcher expo-file-system expo-asset
```

</TabItem>
</Tabs>

and then add the following code in your React Native app:

Expand All @@ -28,10 +50,29 @@ initExecutorch({

If you cannot use Expo in your project, proceed with the following steps:

```bash
yarn add react-native-executorch-bare-resource-fetcher
yarn add @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader
```
<Tabs groupId="package-manager">
<TabItem value="npm" label="npm">

```bash
npm install react-native-executorch-bare-resource-fetcher @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader
```

</TabItem>
<TabItem value="pnpm" label="pnpm">

```bash
pnpm add react-native-executorch-bare-resource-fetcher @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader
```

</TabItem>
<TabItem value="yarn" label="yarn">

```bash
yarn add react-native-executorch-bare-resource-fetcher @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-downloader
```

</TabItem>
</Tabs>

and

Expand Down
2 changes: 2 additions & 0 deletions readmes/README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ yarn add @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-down
yarn < ios | android >
```

> npm 和 pnpm 同样适用 — 使用 `npm install``pnpm add` 安装包,使用 `npm run <ios|android>` / `pnpm <ios|android>` 运行应用。
### :two: 设置和初始化

将此添加到您的组件文件中:
Expand Down
2 changes: 2 additions & 0 deletions readmes/README_es.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ yarn add @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-down
yarn < ios | android >
```

> npm y pnpm también funcionan — usa `npm install` o `pnpm add` para los paquetes, y `npm run <ios|android>` / `pnpm <ios|android>` para el paso de ejecución.
### :two: Configuración e inicialización

Agrega esto a tu archivo de componente:
Expand Down
2 changes: 2 additions & 0 deletions readmes/README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ yarn add @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-down
yarn < ios | android >
```

> npm et pnpm fonctionnent aussi — utilisez `npm install` ou `pnpm add` pour les packages, et `npm run <ios|android>` / `pnpm <ios|android>` pour l'étape d'exécution.

### :two: Configuration et Initialisation

Ajoutez ceci à votre fichier de composant :
Expand Down
2 changes: 2 additions & 0 deletions readmes/README_in.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ yarn add @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-down
yarn < ios | android >
```

> npm और pnpm भी काम करते हैं — पैकेजों के लिए `npm install` या `pnpm add` का उपयोग करें, और रन स्टेप के लिए `npm run <ios|android>` / `pnpm <ios|android>` का उपयोग करें।

### :two: सेटअप और आरंभिककरण

अपने घटक फाइल में यह जोड़ें:
Expand Down
2 changes: 2 additions & 0 deletions readmes/README_pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ yarn add @dr.pogodin/react-native-fs @kesha-antonov/react-native-background-down
yarn < ios | android >
```

> npm e pnpm também funcionam — use `npm install` ou `pnpm add` para os pacotes, e `npm run <ios|android>` / `pnpm <ios|android>` para o passo de execução.
### :two: Configuração e Inicialização

Adicione isso ao seu arquivo de componente:
Expand Down