mirror of
https://github.com/pykeio/ort
synced 2026-04-25 16:34:55 +02:00
docs: nextra v4
This commit is contained in:
21
docs/app/[[...mdxPath]]/page.tsx
Normal file
21
docs/app/[[...mdxPath]]/page.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { generateStaticParamsFor, importPage } from 'nextra/pages';
|
||||
import { useMDXComponents as getMDXComponents } from '../../mdx-components';
|
||||
|
||||
export const generateStaticParams = generateStaticParamsFor('mdxPath');
|
||||
|
||||
export async function generateMetadata(props) {
|
||||
const params = await props.params;
|
||||
const { metadata } = await importPage(params.mdxPath);
|
||||
return metadata;
|
||||
}
|
||||
|
||||
const Wrapper = getMDXComponents().wrapper;
|
||||
|
||||
export default async function DocsPage(props) {
|
||||
const params = await props.params;
|
||||
const result = await importPage(params.mdxPath);
|
||||
const { default: MDXContent, toc, metadata } = result;
|
||||
return <Wrapper toc={toc} metadata={metadata}>
|
||||
<MDXContent {...props} params={params} />
|
||||
</Wrapper>
|
||||
}
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -1,7 +1,3 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
@font-face {
|
||||
font-family: 'TASA Orbiter';
|
||||
src: url("https://parcel.pyke.io/v2/cdn/3rdparty/tasa-orbiter/TASAOrbiterVF.woff2") format("woff");
|
||||
@@ -9,17 +5,19 @@
|
||||
|
||||
html {
|
||||
font-family: 'TASA Orbiter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
|
||||
|
||||
--nextra-primary-hue: 20deg !important;
|
||||
--nextra-primary-saturation: 100% !important;
|
||||
}
|
||||
|
||||
.nextra-menu-desktop > :nth-child(1), .nextra-menu-mobile > :nth-child(1) {
|
||||
a[href="https://opencollective.com/pyke-osai"] {
|
||||
background: linear-gradient(90deg, #45a9fc 0%, #1dfdc8 50%, #54f150 100%);
|
||||
border-radius: 12px;
|
||||
}
|
||||
.nextra-menu-desktop > :nth-child(1) > a, .nextra-menu-mobile > :nth-child(1) > a {
|
||||
padding: 0.5rem;
|
||||
font-weight: 650;
|
||||
color: #fff !important;
|
||||
}
|
||||
.dark .nextra-menu-desktop > :nth-child(1) > a, .dark .nextra-menu-mobile > :nth-child(1) > a {
|
||||
|
||||
.dark a[href="https://opencollective.com/pyke-osai"] {
|
||||
color: #000 !important;
|
||||
}
|
||||
49
docs/app/layout.tsx
Normal file
49
docs/app/layout.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
import type { Metadata } from 'next';
|
||||
import { Footer, Layout, Navbar, ThemeSwitch } from 'nextra-theme-docs';
|
||||
import { Banner, Head, Search } from 'nextra/components';
|
||||
import { getPageMap } from 'nextra/page-map';
|
||||
|
||||
import 'nextra-theme-docs/style.css';
|
||||
import './globals.css';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
metadataBase: new URL('https://ort.pyke.io'),
|
||||
title: {
|
||||
default: 'ort',
|
||||
template: '%s | ort'
|
||||
},
|
||||
description: 'ort is a Rust library for accelerated machine learning inference & training for ONNX models, providing bindings to Microsoft\'s ONNX Runtime and a wrapper around other Rust-native ML crates.',
|
||||
applicationName: 'ort Documentation'
|
||||
};
|
||||
|
||||
export default async function RootLayout({ children }) {
|
||||
const pageMap = await getPageMap();
|
||||
return <html lang='en' dir='ltr' suppressHydrationWarning>
|
||||
<Head faviconGlyph='🦀'>
|
||||
|
||||
</Head>
|
||||
<body>
|
||||
<Layout
|
||||
docsRepositoryBase='https://github.com/pykeio/ort/blob/main/docs'
|
||||
nextThemes={{
|
||||
defaultTheme: 'system'
|
||||
}}
|
||||
navbar={<Navbar
|
||||
logo={<img src="/assets/banner.png" style={{ height: '34px' }} />}
|
||||
chatLink='https://discord.gg/uQtsNu2xMa'
|
||||
projectLink='https://github.com/pykeio/ort'
|
||||
/>}
|
||||
footer={
|
||||
<Footer>
|
||||
<div>
|
||||
<p>made with 💜 by <a target="_blank" href="https://pyke.io/" style={{ textDecoration: 'underline', textDecorationColor: '#05c485' }}><span style={{ color: '#2ba9f6' }}>py</span><span style={{ color: '#00c875' }}>ke</span></a></p>
|
||||
</div>
|
||||
</Footer>
|
||||
}
|
||||
pageMap={pageMap}
|
||||
>
|
||||
{children}
|
||||
</Layout>
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
@@ -1,17 +1,15 @@
|
||||
export default {
|
||||
"link-oc": {
|
||||
"title": "Sponsor ↗",
|
||||
"title": "Sponsor",
|
||||
"href": "https://opencollective.com/pyke-osai",
|
||||
"newWindow": true
|
||||
},
|
||||
"link-api": {
|
||||
"title": "API Reference ↗",
|
||||
"title": "API Reference",
|
||||
"href": "https://docs.rs/ort/2.0.0-rc.9/ort/"
|
||||
},
|
||||
"link-crates": {
|
||||
"title": "Crates.io ↗",
|
||||
"title": "Crates.io",
|
||||
"href": "https://crates.io/crates/ort/2.0.0-rc.9",
|
||||
"newWindow": true
|
||||
},
|
||||
"-- Docs": {
|
||||
"type": "separator",
|
||||
5
docs/content/backends/_meta.tsx
Normal file
5
docs/content/backends/_meta.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
export default {
|
||||
index: 'Alternative backends',
|
||||
candle: 'ort-candle',
|
||||
tract: 'ort-tract'
|
||||
};
|
||||
@@ -1,7 +1,9 @@
|
||||
---
|
||||
title: Backends
|
||||
title: Alternative backends
|
||||
---
|
||||
|
||||
# Alternative backends
|
||||
|
||||
import { Callout, Steps } from 'nextra/components';
|
||||
|
||||
Since [ONNX Runtime](https://onnxruntime.ai/) is written in C++, linking troubles often arise when attempting to use it in a Rust project - especially with WASM. `v2.0.0-rc.10` of `ort` introduced support for **alternative backends** -- that is, ONNX executors that do not use ONNX Runtime.
|
||||
@@ -1,7 +1,9 @@
|
||||
---
|
||||
title: 'Value'
|
||||
title: 'Values'
|
||||
---
|
||||
|
||||
# Values
|
||||
|
||||
import { Callout } from 'nextra/components';
|
||||
|
||||
For ONNX Runtime, a **value** represents any type that can be given to/returned from a session or operator. Values come in three main types:
|
||||
4
docs/content/migrating/_meta.tsx
Normal file
4
docs/content/migrating/_meta.tsx
Normal file
@@ -0,0 +1,4 @@
|
||||
export default {
|
||||
v2: 'Migrating from v1.x to v2',
|
||||
'version-mapping': 'Version mapping'
|
||||
};
|
||||
@@ -3,6 +3,8 @@ title: Migrating from v1.x to v2
|
||||
description: Here's what you need to know to update your application to use the latest & greatest version of ort.
|
||||
---
|
||||
|
||||
# Migrating from v1.x to v2
|
||||
|
||||
## `Environment` no more
|
||||
The `Environment` struct has been removed. Only one `Environment` was allowed per process, so it didn't really make sense to have an environment as a struct.
|
||||
|
||||
@@ -3,14 +3,7 @@ title: Version mapping
|
||||
description: Information about `ort`'s versioning and relation to ONNX Runtime versioning.
|
||||
---
|
||||
|
||||
## A note on SemVer
|
||||
`ort` versions pre-2.0 were not SemVer compatible. From v2.0 onwards, breaking API changes are accompanied by a **major version update**.
|
||||
|
||||
Updates to the version of ONNX Runtime used by `ort` may occur on **minor** version updates, i.e. 2.0 ships with ONNX Runtime 1.21.0, but 2.1 may ship with 1.21.0. ONNX Runtime is generally forward compatible, but in case you require a specific version of ONNX Runtime, you should pin the minor version in your `Cargo.toml` using a [tilde requirement](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#tilde-requirements):
|
||||
```toml
|
||||
[dependencies]
|
||||
ort = { version = "~2.0", ... }
|
||||
```
|
||||
# Version mapping
|
||||
|
||||
## Versions of ONNX Runtime used by `ort`
|
||||
|
||||
@@ -23,3 +16,23 @@ ort = { version = "~2.0", ... }
|
||||
| v1.14.0-v1.14.1 | v1.14.0 |
|
||||
| v1.13.1-v1.13.3 | v1.13.1 |
|
||||
| v1.13.0 | v1.12.1 |
|
||||
|
||||
## Supported ONNX opsets by `ort` version
|
||||
Note that this only applies to the default ONNX Runtime backend.
|
||||
|
||||
| **ort** | **ONNX opset version** | **ONNX ML opset version** |
|
||||
| -------- |:----------------------:|:-------------------------:|
|
||||
| v2.0.0+ | 21 | 4 |
|
||||
| v1.16.0-v1.16.2 | 19 | 3 |
|
||||
| v1.15.0-v1.15.5 | 19 | 3 |
|
||||
| v1.14.0-v1.14.8 | 18 | 3 |
|
||||
| v1.13.0-v1.13.3 | 17 | 3 |
|
||||
|
||||
## A note on SemVer
|
||||
`ort` versions pre-2.0 were not SemVer compatible. From v2.0 onwards, breaking API changes are accompanied by a **major version update**.
|
||||
|
||||
Updates to the version of ONNX Runtime used by `ort` may occur on **minor** version updates, i.e. 2.0 ships with ONNX Runtime 1.21.0, but 2.1 may ship with 1.21.0. ONNX Runtime is generally forward compatible, but in case you require a specific version of ONNX Runtime, you should pin the minor version in your `Cargo.toml` using a [tilde requirement](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#tilde-requirements):
|
||||
```toml
|
||||
[dependencies]
|
||||
ort = { version = "~2.0", ... }
|
||||
```
|
||||
@@ -3,6 +3,8 @@ title: Execution providers
|
||||
description: Learn how to enable execution providers to leverage hardware acceleration.
|
||||
---
|
||||
|
||||
# Execution providers
|
||||
|
||||
import { Callout, Tabs } from 'nextra/components';
|
||||
|
||||
Execution providers (EPs) enable ONNX Runtime to execute ONNX graphs with hardware acceleration. If you have specialized hardware like a GPU or NPU, execution providers can provide a massive performance boost to your `ort` applications. For more information on the intricacies of execution providers, see the [ONNX Runtime docs](https://onnxruntime.ai/docs/execution-providers/).
|
||||
@@ -3,6 +3,8 @@ title: I/O Binding
|
||||
description: Boost efficiency by arranging inputs on an accelerator device prior to graph execution.
|
||||
---
|
||||
|
||||
# I/O Binding
|
||||
|
||||
import { Callout } from 'nextra/components';
|
||||
|
||||
Often times when running a model with a non-CPU [execution provider](/perf/execution-providers), you'll find that the act of copying data between the device and CPU takes up a considerable amount of inference time.
|
||||
@@ -2,6 +2,8 @@
|
||||
title: Cargo features
|
||||
---
|
||||
|
||||
# Cargo features
|
||||
|
||||
> *✅ = default, ⚒️ = not default*
|
||||
|
||||
- ✅ **`ndarray`**: Enables tensors to be created from/extracted to [`ndarray`](https://crates.io/crates/ndarray) multi-dimensional arrays. We highly recommend this feature if you need to do a lot of complex pre/post-processing requiring multi-dimensional array access, but for something like an LLM, omitting this feature won't require too much extra work but will save a fair amount of compile time.
|
||||
@@ -3,6 +3,8 @@ title: Linking
|
||||
description: Here's how `ort` links to ONNX Runtime, and how to configure its behavior.
|
||||
---
|
||||
|
||||
# Linking
|
||||
|
||||
import { Callout, Tabs, Steps } from 'nextra/components';
|
||||
|
||||
`ort` provides its own builds of ONNX Runtime to make your experience as painless as possible, but in some cases, you'll want to use a custom build of ONNX Runtime with `ort`. Luckily, we make this very easy by handling all of the linking configuration automagically. Just point `ort` to the output of ONNX Runtime's build pipeline and it'll Just Work™.
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Platform support
|
||||
description: `ort` supports a wide variety of platforms. For most desktop users, pre-built binaries are available, so setting up `ort` is as simple as adding it to your `Cargo.toml`!
|
||||
description: "`ort` supports a wide variety of platforms. For most desktop users, pre-built binaries are available, so setting up `ort` is as simple as adding it to your `Cargo.toml`!"
|
||||
---
|
||||
|
||||
import { Callout } from 'nextra/components';
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: 'Troubleshooting: Issues compiling/linking'
|
||||
---
|
||||
|
||||
# Troubleshooting: Issues compiling/linking
|
||||
|
||||
## The trait bound `ort::value::Value: From<...>` is not satisfied
|
||||
An error like this might come up when attempting to upgrade from an earlier (1.x) version of `ort` to a more recent version:
|
||||
```
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: 'Troubleshooting: Logging'
|
||||
---
|
||||
|
||||
# Troubleshooting: Logging
|
||||
|
||||
import { Tabs, Steps } from 'nextra/components';
|
||||
|
||||
`ort` hooks into ONNX Runtime to route its logging messages through the [`tracing`](https://crates.io/crates/tracing) crate. These logging messages can often provide more helpful information about specific failure modes than `ort`'s error messages alone.
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: 'Troubleshooting: Performance'
|
||||
---
|
||||
|
||||
# Troubleshooting: Performance
|
||||
|
||||
## Execution providers don't seem to register
|
||||
`ort` is designed to fail gracefully when an execution provider is not available or fails to register. To debug errors raised by EPs, [set up logging for `ort`](/troubleshooting/logging).
|
||||
|
||||
8
docs/mdx-components.ts
Normal file
8
docs/mdx-components.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { useMDXComponents as getDocsMDXComponents } from 'nextra-theme-docs';
|
||||
|
||||
const docsComponents = getDocsMDXComponents();
|
||||
|
||||
export const useMDXComponents = (components = {}) => ({
|
||||
...docsComponents,
|
||||
...components
|
||||
});
|
||||
3
docs/next-env.d.ts
vendored
3
docs/next-env.d.ts
vendored
@@ -1,5 +1,6 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
/// <reference types="next/navigation-types/compat/navigation" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import nextra from 'nextra';
|
||||
|
||||
export default nextra({
|
||||
theme: 'nextra-theme-docs',
|
||||
themeConfig: './theme.config.jsx'
|
||||
search: {
|
||||
codeblocks: true
|
||||
},
|
||||
codeHighlight: true,
|
||||
defaultShowCopyCode: true,
|
||||
contentDirBasePath: '/'
|
||||
})({
|
||||
reactStrictMode: true,
|
||||
output: 'export',
|
||||
images: {
|
||||
unoptimized: true
|
||||
|
||||
@@ -3,24 +3,29 @@
|
||||
"name": "ort-docs",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"dev": "next dev --turbopack",
|
||||
"build": "next build",
|
||||
"start": "next start"
|
||||
"start": "next start",
|
||||
"postbuild": "pagefind --site .next/server/app --output-path out/_pagefind"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "^15.0.2",
|
||||
"nextra": "^3.2.0",
|
||||
"nextra-theme-docs": "^3.2.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
"next": "^15.2.4",
|
||||
"nextra": "^4.2.17",
|
||||
"nextra-theme-docs": "^4.2.17",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.8.6",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.47",
|
||||
"tailwindcss": "^3.4.14",
|
||||
"typescript": "^5.6.3"
|
||||
"@types/node": "^22.14.0",
|
||||
"@types/react": "^19.1.0",
|
||||
"@types/react-dom": "^19.1.1",
|
||||
"pagefind": "^1.3.0",
|
||||
"typescript": "^5.8.2"
|
||||
},
|
||||
"packageManager": "pnpm@10.6.5+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af",
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
"sharp"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import './globals.css';
|
||||
|
||||
export default function App({ Component, pageProps }) {
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
export default {
|
||||
index: 'Backends',
|
||||
candle: 'Candle',
|
||||
tract: 'Tract'
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
export default {
|
||||
v2: 'Migrating from v1.x to v2',
|
||||
'version-mapping': 'Version mapping',
|
||||
opsets: 'ONNX opsets'
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
---
|
||||
title: ONNX opsets
|
||||
description: Supported opsets by `ort` version
|
||||
---
|
||||
|
||||
| **ort** | **ONNX opset version** | **ONNX ML opset version** |
|
||||
| -------- |:----------------------:|:-------------------------:|
|
||||
| v2.0.0+ | 21 | 4 |
|
||||
| v1.16.0-v1.16.2 | 19 | 3 |
|
||||
| v1.15.0-v1.15.5 | 19 | 3 |
|
||||
| v1.14.0-v1.14.8 | 18 | 3 |
|
||||
| v1.13.0-v1.13.3 | 17 | 3 |
|
||||
2915
docs/pnpm-lock.yaml
generated
2915
docs/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,8 +0,0 @@
|
||||
import type { Config } from 'tailwindcss';
|
||||
|
||||
export default {
|
||||
content: [
|
||||
'./pages/**/*.{js,ts,jsx,tsx,md,mdx}'
|
||||
],
|
||||
darkMode: 'selector'
|
||||
} as const satisfies Config;
|
||||
@@ -1,43 +0,0 @@
|
||||
import Image from 'next/image';
|
||||
import { useConfig } from 'nextra-theme-docs';
|
||||
|
||||
/** @type {import('nextra-theme-docs').DocsThemeConfig} */
|
||||
const config = {
|
||||
project: {
|
||||
link: 'https://github.com/pykeio/ort'
|
||||
},
|
||||
chat: {
|
||||
link: 'https://discord.gg/uQtsNu2xMa'
|
||||
},
|
||||
docsRepositoryBase: 'https://github.com/pykeio/ort/blob/main/docs',
|
||||
head: function Head() {
|
||||
const config = useConfig();
|
||||
|
||||
const pageTitle = config.frontMatter.title || config.title;
|
||||
const title = pageTitle ? `${pageTitle} | ort` : 'ort';
|
||||
|
||||
return <>
|
||||
<title>{title}</title>
|
||||
|
||||
<meta name='description' content='ort is a community-maintained ONNX Runtime binding for Rust, enabling fast ML inference & training for a wide range of devices.' />
|
||||
</>;
|
||||
},
|
||||
logo: <img src="/assets/banner.png" style={{ height: '34px' }} />,
|
||||
darkMode: true,
|
||||
nextThemes: {
|
||||
defaultTheme: 'system'
|
||||
},
|
||||
footer: {
|
||||
content: <div>
|
||||
<p>made with 💜 by <a target="_blank" href="https://pyke.io/" style={{ textDecoration: 'underline', textDecorationColor: '#05c485' }}><span style={{ color: '#2ba9f6' }}>py</span><span style={{ color: '#00c875' }}>ke</span></a> • <a target="_blank" href="https://opencollective.com/pyke-osai" style={{ textDecoration: 'underline' }}>sponsor</a></p>
|
||||
</div>
|
||||
},
|
||||
color: {
|
||||
hue: 20,
|
||||
saturation: 100
|
||||
},
|
||||
toc: {
|
||||
float: true
|
||||
}
|
||||
};
|
||||
export default config;
|
||||
@@ -10,18 +10,25 @@
|
||||
"strict": false,
|
||||
"noEmit": true,
|
||||
"incremental": true,
|
||||
"module": "esnext",
|
||||
"module": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
"moduleResolution": "nodenext",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"target": "ES2017"
|
||||
"target": "ES2017",
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"strictNullChecks": true
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx"
|
||||
"**/*.tsx",
|
||||
"next-env.d.ts",
|
||||
".next/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
|
||||
Reference in New Issue
Block a user