Skip to content

[RNE Rewrite] docs: rewrite documentation - #1388

Open
barhanc wants to merge 77 commits into
rne-rewritefrom
@bh/docs
Open

[RNE Rewrite] docs: rewrite documentation#1388
barhanc wants to merge 77 commits into
rne-rewritefrom
@bh/docs

Conversation

@barhanc

@barhanc barhanc commented Aug 27, 2026

Copy link
Copy Markdown
Member

Description

Comprehensive rewrite of documentation across Natural Language, Speech, and Computer Vision task extensions, alongside a modern overhaul of the root README.md reflecting the v0.10 architecture.

Introduces a breaking change?

  • Yes
  • No

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Other (chores, tests, code style improvements etc.)

Tested on

  • iOS
  • Android

Testing instructions

Screenshots

Related issues

Closes #1163 #1288

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

@barhanc barhanc self-assigned this Aug 27, 2026
@barhanc barhanc added the documentation Improvements or additions to documentation label Aug 27, 2026
@barhanc
barhanc force-pushed the @bh/docs branch 2 times, most recently from e6ca40e to 0a92126 Compare August 27, 2026 14:59
@barhanc barhanc changed the title @bh/docs [RNE Rewrite] docs: rewrite documentation Aug 31, 2026
@barhanc
barhanc marked this pull request as ready for review August 31, 2026 15:41
@msluszniak
msluszniak self-requested a review August 31, 2026 15:44
@barhanc

barhanc commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

@msluszniak This is not yet fully ready, as I need to record all the videos for task docs and implement the vision camera demo, but the documentation content itself is ready to review. Two pages that require special attention are:

  • docs/docs/01-fundamentals/02-downloading-models.md
  • docs/docs/03-core-and-advanced/08-native-libraries.md

as these are mostly concerned with fetcher and the binaries split. The migration doc will need to be written once we merge the rewrite branch into main and resolve the API migration (after that we will have to also update the code snippets to use proper entry points but that's automatic work). The gallery repo also needs to be transfered to swm-labs and we are missing benchmarks.

@msluszniak

Copy link
Copy Markdown
Member

@msluszniak This is not yet fully ready, as I need to record all the videos for task docs and implement the vision camera demo, but the documentation content itself is ready to review. Two pages that require special attention are:

  • docs/docs/01-fundamentals/02-downloading-models.md
  • docs/docs/03-core-and-advanced/08-native-libraries.md

as these are mostly concerned with fetcher and the binaries split. The migration doc will need to be written once we merge the rewrite branch into main and resolve the API migration (after that we will have to also update the code snippets to use proper entry points but that's automatic work). The gallery repo also needs to be transfered to swm-labs and we are missing benchmarks.

Understood. I'll scan through all the documentation with special attention to these two. Do we have an idea when specifically we want to merge rne-rewrite to main, after merging this PR?

@barhanc

barhanc commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

I'd say this should be the last PR merged into rne-rewrite before merging rne-rewrite into main, so we should wait with this one until everything else is ready-to-go, merge this and then merge rewrite into main.

@msluszniak msluszniak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First batch of suggestions, based on fundamentals and extensions sections. Now moving to core, readmes etc.

Comment thread docs/docs/01-fundamentals/01-getting-started.md Outdated
Comment thread docs/docs/01-fundamentals/01-getting-started.md
Comment thread docs/docs/01-fundamentals/01-getting-started.md Outdated
Comment thread docs/docs/01-fundamentals/01-getting-started.md Outdated
Comment thread docs/docs/01-fundamentals/01-getting-started.md Outdated
Comment thread docs/docs/02-extensions/computer-vision/07-instance-segmentation.md Outdated
Comment thread docs/docs/02-extensions/computer-vision/02-image-classification.md
Comment thread docs/docs/02-extensions/natural-language/05-tokenizers.md Outdated
Comment thread docs/docs/02-extensions/natural-language/05-tokenizers.md Outdated
Comment thread docs/docs/02-extensions/speech/02-text-to-speech.md
@msluszniak

Copy link
Copy Markdown
Member

Docs build fails on ca9e1b0b: two broken links in docs/docs/02-extensions/speech/03-speech-to-text.md:101 point at 06-api-reference/type-aliases/WhisperStreamUpdate.md, which typedoc never generates, since stream() returns an inline anonymous { committed; nonCommitted } rather than an exported type alias (whisperSpeechToText.ts:162).

Dropping those two links (or exporting WhisperStreamUpdate) makes yarn build pass clean.

barhanc and others added 11 commits September 2, 2026 18:48
…ns & core overview

- Rewrite getting-started with two-layer architecture intro, ExecuTorch as PyTorch Core project
- Add 'Selecting native libraries' subsection under Installation
- Move native-libraries to core-and-advanced, rewrite for readability with full feature table
- Remove architecture.md and loading-models.md from fundamentals
- Move migrating-from-v0-9.md to #2 in fundamentals
- Add generated-index cards for Extensions and Core & Advanced sections
- Add extensions overview pages for computer-vision, natural-language, speech
- Fix broken anchors and links throughout
…s, errors, worklets)

- Rewrite Models & Tensors around the explicit fn(src, dst) memory model,
  through-chaining, lifecycle, and thread safety
- Add Schema Validation: exported vs allowed specs, symbolic dims, domains
  vs runtime constraints, primitives, multi-method models, get_model_schema
- Add Operations & Utilities (renamed from Tensor Operations): native
  math/cv/speech ops plus nlp/llm and numeric utilities
- Add Error Handling: the code set, isRnExecuTorchError narrowing, throwing
- Add Worklets & Threading: the three execution contexts, wrapAsync, the
  dual-API pattern
- Reorder sidebar so Error Handling precedes Worklets & Threading
- Cross-link every symbol to the API reference; minor getting-started polish

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cover integrating a custom .pte both into a built-in pipeline (inspectModel,
discovering the contract, reconciling) and into a custom pipeline you build on
the primitives. Delegate actual export to the ExecuTorch docs. Document the
get_model_schema companion for dynamic shapes, with the payload's JSON Schema
embedded in a collapsible for reference.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Add a Fundamentals "Downloading Models" page: the models registry, automatic
  download/caching in hooks (useResourceDownload, ResourceOptions), the imperative
  download API (DownloadOptions: progress, abort, forceDownload), and caching
  behavior; renumber the migration guide to 03
- Document the new createResourceScope primitive in the Models & Tensors lifecycle
  section (failure-safe construction) and reference it from the custom-pipeline
  example in Exporting Custom Models

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Add @typeParam/@param/@returns to ResourceScope.track in lifetime.ts so the
  generated reference documents the generic
- Link createResourceScope, ResourceScope, and NativeResource from the Models &
  Tensors lifecycle section and API-reference list

(--no-verify: the pre-commit `types` hook fails on pre-existing @types/jest errors
in upstream __tests__; unrelated to this jsdoc/docs change)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Re-add the Other > Compatibility page (from main) that the rewrite restructure
  dropped, and link it from Getting Started with a relative doc link instead of a
  raw URL
- Drop the two resource-fetcher compatibility tables, since those packages no
  longer exist in this version (the fetcher is built into react-native-executorch)
- Trim the extensions category description to one sentence

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread docs/docs/03-core-and-advanced/03-schema-validation.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List of supported backends is not up to date.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this whole file should be rewritten, but I just don't really know what to put there regarding native libraries download, e.g. the building from source part doesn't really fit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah building from source is on our side so probably we shouldn't mention it.

@msluszniak msluszniak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Symbol level accuracy is good: every imported name, models.* registry path, namespace member and the error code table check out against source. Points below.

One finding with no diff anchor: docs-build-check.yml only triggers on PRs to main, so the docs build never ran on this PR. That matters because it adds ~740 relative links into the typedoc generated 06-api-reference/, which nothing has verified, and onBrokenLinks is throw. Worth adding rne-rewrite to that workflow here.


// Hook state:
// classifier.isReady — true once model is downloaded and loaded in memory
// classifier.downloadProgress — 0.0 to 1.0 download progress

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downloadProgress is 0 to 100, not 0.0 to 1.0: useResourceDownload sets progress * 100 and the hooks forward it verbatim. The same wrong comment is in 14 other extension guides. Note download()'s onProgress really is 0 to 1, so the two APIs differ and only this one is wrong.

Comment thread docs/sidebars.js
description:
'Lower-level APIs for direct ExecuTorch model execution, tensor operations, and custom pipelines.',
},
items: [{ type: 'autogenerated', dirName: '03-core-and-advanced' }],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

07-other is never added here, so the new compatibility page gets no sidebar entry and is reachable only by direct URL. The old file had a commented-out Other category that was dropped rather than re-enabled.

<td><div className={styles.supported}>yes</div></td>
</tr>
<tr>
<td><div className={styles.version}>0.9.x</div></td>

@msluszniak msluszniak Sep 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No 0.10.x row, which is the version this PR documents, we want to keep this one or not really?

This allows us to use binaries, such as exported models or tokenizers for LLMs.
- **New Architecture** enabled
- **React Native 0.81+** (or compatible Expo SDK using development builds)
- **iOS 17.0+** / **Android 13+ (API 33)**

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does API 33 come from? android/build.gradle.kts defaults minSdk = 21 and RN 0.81's own floor is 24. iOS 17.0 checks out against the podspec. Also no minimum Expo SDK is given despite the line above.

When using Expo, please note that you need to use a custom development build of your app, not the standard Expo Go app. This is because we rely on native modules, which Expo Go doesn’t support.
For supported React Native versions, see the [Compatibility
table](../07-other/01-compatibility.mdx).
:::

@msluszniak msluszniak Sep 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old getting started warned that iOS Release builds cannot target a simulator. That caveat is now nowhere in the docs and it is a recurring support question. Is this still an issue or not really anymore?

const model = await wrapAsync(loadModel)('/path/to/model.pte');

// Inside a worklet runtime, the synchronous call is fine
const model = loadModel('/path/to/model.pte');

@msluszniak msluszniak Sep 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const model is declared twice in this block, so the snippet does not compile as pasted. The question is if we want our snippets to be compilable? If not necessary, then just skip this comment and resolve.


## Throwing Errors in Custom Pipelines

When writing custom pipelines or task helpers, use the [`RnExecuTorchError`](../06-api-reference/functions/RnExecuTorchError.md) factory function. Do **not** use `new RnExecuTorchError()`, as plain object factories can be safely passed across worklet boundaries:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason clause does not support the prohibition. Should be closer to: class instances lose their prototype across worklet boundaries, plain object factories survive.


```typescript
import { models, useLLMChatSession } from 'react-native-executorch';
import type { ImageBuffer } from 'react-native-executorch/cv';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subpath imports (react-native-executorch/cv, /llm) are used in snippets but never explained anywhere, and are silently mixed with namespace imports from the root. One sentence in Operations & Utilities would cover it.

Comment thread docs/typedoc.json
"compilerOptions": {
"skipLibCheck": true
},
"compilerOptions": { "skipLibCheck": true },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gratuitous reformat that prettier may revert. The validation block added below is a good change though.

Comment thread .gitattributes
# Linguist vendoring for accurate language statistics and cloc
third-party/** linguist-vendored
**/third-party/** linguist-vendored
packages/react-native-executorch/third-party/** linguist-vendored No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

**/third-party/** already covers both other rules. Also still no trailing newline, and this is unrelated to a docs PR.

@msluszniak

Copy link
Copy Markdown
Member

Also, I think that is the right moment to wire some maybe not-working but targeting main CI for validating and publishing documentation like we have on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RNE Rewrite] Streamline apps to show idiomatic usage of the library Docs - refactor & simplification

2 participants