85 Commits

Author SHA1 Message Date
Carson M.
f085e4c251 2.0.0-rc.12 2026-03-04 23:02:09 -06:00
Carson M.
d443aec9f8 examples(model-info): list custom metadata 2026-02-12 21:28:01 -06:00
Carson M.
46d50d6c26 examples: remove wasm-emscripten example
to be replaced by `ort-web` example
2026-02-12 21:28:01 -06:00
Carson M.
967b61824f examples(model-info): update api 2026-02-11 11:29:10 -06:00
Carson M.
de97dfc79e examples: reduce dependencies for CV examples 2026-02-05 20:29:24 -06:00
Carson M.
98519baca8 refactor!: flatten operator module 2026-01-15 02:21:04 -06:00
Carson M.
25a6760783 refactor: merge tensor module into value 2026-01-15 02:03:23 -06:00
Carson M.
b50842ffa9 2.0.0-rc.11 2026-01-06 22:23:32 -06:00
Carson M.
3b408b1b44 refactor: shorten execution_providers
frankly, working on documentation has made me tired of typing out `execution_providers` and `ExecutionProvider` all the time
2025-11-14 23:57:09 -06:00
Michael Partheil
716f34f143 chore: Update ndarray to v0.17 (#484) 2025-11-05 14:04:07 -06:00
Carson M.
75d43518bd chore: use 2024 edition Rust 2025-10-25 15:39:24 -05:00
Carson M.
e169561d42 examples(model-info): update
should really be checking these in CI...
2025-09-09 14:23:38 -05:00
Carson M.
317be209b1 fix: let Environment drop, closes #441
Let it die, let it die! You shall die

Instead of creating an environment that lives throughout the duration of the process, we now hold the environment options we commit, and create the environment from those options (or grab the current env) whenever we need it. When all holders of the environment are dropped, the environment is dropped as well.

Previously, we held `Environment` as a static variable. Statics are never dropped, but ONNX Runtime's own destructors assumes that the environment is long gone by the time the process exits, which was not the case in `ort`! This led to issues like #441 and the dumb `0003-leak-logger-mutex.patch` from `ort-artifacts`.
2025-08-31 18:57:38 -05:00
Carson M.
daf91046dc 2.0.0-rc.10 2025-05-31 23:56:41 -05:00
Carson M.
75ec921a1e examples: document examples
I'm pretty sure the modnet photo was taken by Charlotte May, not "Tyler Nix". The link leftover from cudarc's COPYRIGHT.md (btw, why did I delete that file from modnet?) is now a 404. Reverse image search led me to Charlotte May's photo on Pexels, and their profile features more photos of the same person. Does this mean 'Tyler Nix' is a THIEF...? Nixgate!!1!

Also, I once again apologize for saying I was gonna do this however long ago and then promptly forgetting to do it
2025-04-28 01:52:47 -05:00
Carson M.
9b316809bf fix(sys): do not require -fapple-link-rtlib
it really is that shrimple
2025-04-20 10:55:08 -05:00
Carson M.
317d64bd70 feat: add back usize constructors for Shape, ref #370 2025-03-27 10:53:53 -05:00
Carson M.
dc76596976 examples: rework examples, ref #367
run with `cargo example-<name>`
2025-03-22 00:04:21 -05:00
Carson M.
072e162ce0 refactor!: rename extract_tensor -> extract_array, extract_raw_tensor -> extract_tensor
...and `extract_raw_map` to `extract_key_values`, but nobody cares about that
2025-03-20 00:44:15 -05:00
Carson M.
c44ad97530 example(phi-3-vision): remove useless branch 2025-03-20 00:19:57 -05:00
Carson M.
909e41f26a refactor!: opaque tensor shape, rename dimensions to shape 2025-03-12 22:28:18 -05:00
decahedron1
674baa7497 examples: WASM Emscripten example (#347/#363)
Co-authored-by: r.menges <Raphael.Menges@alfatraining.de>
2025-03-11 13:30:20 -05:00
Carson M.
4d45331390 refactor: reduce the size of generated code
small breaking change is that `run_async` now requires `RunOptions`
2025-03-06 23:25:15 -06:00
Carson M.
d738b1757b chore: start moving stuff off parcel 2025-02-21 23:31:14 -06:00
Carson M.
8aab523770 feat(training): improve training API coverage 2025-02-21 23:26:36 -06:00
Carson M.
bd2aff711e refactor!: make Session::run take &mut self 2025-02-08 11:56:51 -06:00
Carson M.
c5a06a731a chore: remove ndarray for examples that do not need it 2024-12-21 01:01:48 -06:00
Carson M.
4d16d600d5 test: zero out first input for custom-ops tests 2024-12-21 01:01:15 -06:00
Carson M.
cf447cf566 fix: do not require 'static for run_async inputs 2024-12-21 01:00:14 -06:00
Carson M.
9ea18d815b refactor!: allow zero-copy from_array for array views with TensorRef
This has all sorts of fun breaking changes:
- `ort::inputs!` no longer yields an `ort::Result<...>` (thank God)
- `Tensor::from_array` now only accepts owned data.
- Introduce `TensorRef::from_array_view` and `TensorRefMut::from_array_view_mut`.
- `TryFrom<A>` is no longer implemented for `Tensor<T>` for any variants.

This opens the door to new optimizations on top of fixing a few unsoundness issues.

TODO: update docs
2024-12-21 00:24:54 -06:00
Carson M.
393711eb56 refactor!: dyn compatible Operator 2024-11-29 13:39:45 -06:00
Carson M.
87577ef396 feat: many a feature
I did that thing again!

Features in this commit:
- `ThreadManager` allows you to define custom thread creation functions for environments & sessions.
- Sessions can now opt-out of using the environment's global thread pool.
- Implemented the safe `ShapeInferenceContext` wrapper for custom operators.
- Prepacked weights allow the CPU execution provider to share one allocation for identical weights between sessions.
- Customize workload type to prioritize efficiency; useful for background tasks.
- Configurable per-session log identifiers
- Dynamic dimension overrides

Breaking changes:
- `EnvironmentGlobalThreadPoolOptions` is now `GlobalThreadPoolOptions` and uses the builder pattern instead of exposed struct fields.
2024-11-18 19:38:59 -06:00
Carson M.
1dbad54248 refactor!: precompute value dtype/memory info
Breaking because `extract_tensor_*` now returns `&[i64]` for dimensions, and `dtype()` and `memory_info()` also return references.

Each tensor extract call not only had multiple FFI calls to determine the `ValueType`, but also had to determine `MemoryInfo` to ensure the data was CPU-accessible. Since neither the data type or memory location can *change* for a given value, it doesn't make sense to compute this on each extract call; it's better to compute it once, when we create the `Value` (and we often already have the types created by this time, so little FFI is actually required).

This should make `extract_tensor_raw` zero-alloc, most benefitting usages of `IoBinding`/`OutputSelector`. This does mean usages of `Value` without ever extracting said value (like HF Transformers hidden state outputs which go ignored) incur slightly more overhead, but the tradeoff of having less overhead at extraction time seems worth it.
2024-11-15 18:08:42 -06:00
Carson M.
d4f82fc50e refactor!: undo The Flattening 2024-11-12 22:19:15 -06:00
Carson M.
3f2fba1cbf fix: remove deprecated function usage 2024-11-12 13:40:29 -06:00
Carson M.
67d579404a chore: address clippy warnings 2024-10-18 09:35:58 -05:00
web3nomad.eth
87dc4f21fa examples(phi-3-vision): Simplify input processing with KV cache (#296)
With KV cache, full input sequence reconstruction is unnecessary.
Only process the newly generated token for each iteration.
2024-10-15 11:02:09 -05:00
Carson M.
cdd6be7a66 chore(*): format code 2024-10-14 00:41:21 -05:00
web3nomad.eth
b17dbdb643 examples: image chat generation with phi-3 vision (#291) 2024-10-04 10:26:52 -05:00
Carson M.
a9557aae39 examples(model-info): display optional types 2024-09-04 20:15:53 -05:00
Carson M.
2d26f1f363 refactor: opaque Error
Shaves off the `thiserror` dependency and should improve compile times slightly.
Unfortunately this does mean we can't match on `Error` anymore, though I'm not sure if that was ever useful to begin with.
2024-08-31 15:17:06 -05:00
Carson M.
e2c454941b chore: remove wasm32-unknown-unknown support 2024-08-13 09:11:30 -05:00
Carson M.
069ddfdd2c chore: update ndarray to 0.16 2024-08-04 12:24:48 -05:00
Carson M.
733b7fa329 feat(training): simple trainer callbacks 2024-08-03 13:33:44 -05:00
Carson M.
e5970e559a chore: format 2024-07-29 17:57:41 -05:00
Carson M.
c5538f26d0 examples: refactor all-mini-lm-l6 for semantic similarity 2024-07-22 19:53:23 -05:00
Nigel Christian
1a10b11b10 examples: add all-mini-lm-l6 example (#243) 2024-07-21 15:47:24 -05:00
Carson M
0a43482d03 feat: training (#202) 2024-07-06 11:07:27 -05:00
Carson M.
c64b8ea990 refactor: usability
aka The Cleanening, part 2

- Add clearer documentation and examples for more things.
- Rework string tensors by introducing `PrimitiveTensorElementType` for primitive (i.e. f32) types, and again re-implementing `IntoTensorElementType` for `String`. This allows string tensors to be used via `Tensor<String>` instead of exclusively via `DynTensor`. Additionally, string tensors no longer require an `Allocator` to be created (which didn't make sense, since string data in Rust can only ever be stored on the CPU anyway). This also now applies to `Map`s, since their data also needed to be on the CPU anyway. (`Sequence`s are currently unaffected because I think a custom allocator could be useful for them?)
- Rework the `IoBinding` interface, and add an example clarifying the intended usage of it (ref #209). Thanks to AAce from the pyke Discord for pointing out the mutability issue in the old interface, which should be addressed now.
- Refactor `OperatorDomain::add` from the slightly-nicer-looking-but-more-confusing `fn<T>(t: T)` to just `fn<T>()` to further enforce the fact that `Operator`s are zero-sized.
- Maps can now have `String` keys.
- Remove some unused errors.
2024-06-21 15:37:39 -05:00
Carson M.
23fce788b6 feat: option to error out session builder if EP registration fails 2024-06-14 18:07:13 -05:00