diff --git a/.github/workflows/local-models.yml b/.github/workflows/local-models.yml deleted file mode 100644 index c491db5e78..0000000000 --- a/.github/workflows/local-models.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Optional local models - -# This optional, native-only gate runs solely on an explicit maintainer/contributor request. -on: - workflow_dispatch: - -permissions: - contents: read - -concurrency: - group: local-models-${{ github.ref }} - cancel-in-progress: true - -jobs: - cpu: - name: CPU (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - timeout-minutes: 45 - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - env: - CARGO_INCREMENTAL: "0" - CARGO_PROFILE_DEV_DEBUG: "0" - CARGO_PROFILE_TEST_DEBUG: "0" - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable - with: - components: clippy - - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - with: - key: optional-local-ml - - name: Install Linux UI dependencies - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends \ - libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev \ - libgl1-mesa-dev libgtk-3-dev - # Synthetic ONNX graphs exercise the actual runtime and both adapters. No model weights - # are fetched in CI; only ort's pinned build-time runtime redistribution is downloaded. - - name: Test native runtime and download verification - run: cargo test -p photocraft-ml --features onnx --locked - - name: Test commands and CLI with the optional backend - run: cargo test -p photocraft-engine -p photocraft-cli --features local-ml --locked - - name: Test model preferences and translated labels - run: | - cargo test -p photocraft-ui-egui --features local-ml --locked --lib prefs_ui::tests - cargo test -p photocraft-ui-egui --features local-ml --locked --lib i18n::tests - - name: Check native app and UI with the optional backend - run: cargo check -p photocraft -p photocraft-ui-egui --features local-ml --locked - - name: Clippy optional backend - run: cargo clippy -p photocraft-ml -p photocraft-engine -p photocraft-cli --features photocraft-ml/onnx,local-ml --all-targets --locked -- -D warnings diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 0949a1056a..2c08025c0d 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -81,25 +81,10 @@ The other built-in ICC profiles and the generated LUT looks are produced by code (`crates/cms/src/builtin.rs`, `crates/cms/src/lutfile.rs`) and dedicated to the public domain (CC0-1.0); they are not separate files. -## Optional local models and runtime - -Model weights are explicit downloads, not files committed or bundled in the default app. -Immutable revisions, artifact sizes and hashes are recorded in `crates/ml/src/catalog.rs`. -The download cache includes the original model licence and a source/revision notice. - -| Path / optional artifact | Title | Author | Source | License | -|---|---|---|---|---| -| Downloaded `birefnet-hr-matting-*/model.onnx` | BiRefNet HR Matting, FP32 ONNX export | Peng Zheng and BiRefNet contributors; export by PinkPixel | [Original checkpoint](https://huggingface.co/ZhengPeng7/BiRefNet_HR-matting), [pinned export](https://huggingface.co/PinkPixel/birefnet-hr-matting-onnx/tree/792518b9d4dfe9793891712677de25e554f948c6) | MIT, [`BiRefNet-MIT.txt`](crates/ml/licenses/BiRefNet-MIT.txt) | -| Downloaded `sam2.1-large-*/{vision_encoder,prompt_encoder_mask_decoder}.onnx{,_data}` | SAM 2.1 Hiera Large, FP32 ONNX export | Meta / SAM 2 contributors; export by ONNX Community | [Original checkpoint](https://huggingface.co/facebook/sam2.1-hiera-large), [pinned export](https://huggingface.co/onnx-community/sam2.1-hiera-large-ONNX/tree/3c23431f721e69cae82dbfd0c28fd692cc714021) | Apache-2.0, [`SAM2-Apache-2.0.txt`](crates/ml/licenses/SAM2-Apache-2.0.txt) | -| Build-time ONNX Runtime redistribution (`local-ml` only) | ONNX Runtime 1.28 CPU runtime | Microsoft and contributors; redistribution by pyke / ort | [ONNX Runtime](https://github.com/microsoft/onnxruntime), [ort 2.0.0-rc.13](https://github.com/pykeio/ort) | MIT, [`ONNXRuntime-MIT.txt`](crates/ml/licenses/ONNXRuntime-MIT.txt), [`third-party notices`](crates/ml/licenses/ONNXRuntime-ThirdPartyNotices.txt) | -| `crates/ml/src/test_models.rs` | Original tiny ONNX contract fixtures (Rust byte constants, no learned weights) | PhotoCraft contributors | Original synthetic graphs: mean/sigmoid, constant embeddings and scored masks | MIT OR Apache-2.0 | - ## Documentation and README | Path | Title | Author | Source | License | |---|---|---|---|---| -| `docs/images/local-models-before.png`, `docs/images/local-models-preferences.png` | PhotoCraft Preferences before / after optional models | PhotoCraft contributors | Original offscreen screenshots | MIT OR Apache-2.0, [`licence`](docs/images/LICENSE-local-models.txt) | -| `docs/images/local-models-comparison.png` | Classical / BiRefNet / SAM actual command outputs using *Girl with a Pearl Earring* | Artwork: Johannes Vermeer, c. 1665; presentation: PhotoCraft contributors | [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:1665_Girl_with_a_Pearl_Earring.jpg), exported masks | Artwork: public domain (PD-Art); presentation: MIT OR Apache-2.0, [`licence`](docs/images/LICENSE-local-models.txt) | | `docs/brand/` (all files) | ArtCraft name, wordmark and mark | ArtCraft Team | getartcraft.com | Not open source; trademarks of the ArtCraft Team, [`docs/brand/LICENSE-brand.txt`](docs/brand/LICENSE-brand.txt) | | `docs/images/photocraft-*.jpg` | PhotoCraft screenshots | PhotoCraft contributors (UI) | Rendered offscreen with the `snapshot` example | MIT OR Apache-2.0 (UI); the artwork in each is public domain, listed below | | `docs/images/preferences-apply-*.png` | Preferences before and after adding Apply (no artwork) | PhotoCraft contributors | PhotoCraft control-channel capture and offscreen `snapshot` example | MIT OR Apache-2.0 | diff --git a/Cargo.lock b/Cargo.lock index d321158ba3..75e1ea9149 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -277,7 +277,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -288,7 +288,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -816,12 +816,6 @@ dependencies = [ "syn 3.0.6", ] -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "byteorder-lite" version = "0.1.0" @@ -2760,12 +2754,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hmac-sha256" -version = "1.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad320b3b96fb2a455a0726d16efe0a5afdbd34b71dea5bc53b05ea057714d4e" - [[package]] name = "http" version = "1.5.0" @@ -3708,22 +3696,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" -[[package]] -name = "lzma-rust2" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e20f57f9918e5bd7bc58c22cdd70a6afc7375d4dd9683af5f2b34bd3d2bba619" - -[[package]] -name = "matrixmultiply" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7" -dependencies = [ - "autocfg", - "rawpointer", -] - [[package]] name = "maybe-owned" version = "0.3.4" @@ -3888,21 +3860,6 @@ dependencies = [ "thiserror 2.0.21", ] -[[package]] -name = "ndarray" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d" -dependencies = [ - "matrixmultiply", - "num-complex", - "num-integer", - "num-traits", - "portable-atomic", - "portable-atomic-util", - "rawpointer", -] - [[package]] name = "ndk" version = "0.9.0" @@ -4601,30 +4558,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "ort" -version = "2.0.0-rc.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4336a1e2b38848325241c72889086886004e589b7c74f335e60a8e8db5138a0b" -dependencies = [ - "ndarray", - "ort-sys", - "smallvec", - "tracing", - "ureq", -] - -[[package]] -name = "ort-sys" -version = "2.0.0-rc.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf211e3776eea6aec988552fa118dd746d70e1b1e5e244058d1c98015f3e5872" -dependencies = [ - "hmac-sha256", - "lzma-rust2", - "ureq", -] - [[package]] name = "os_pipe" version = "1.2.3" @@ -5009,7 +4942,6 @@ dependencies = [ "photocraft-geom", "photocraft-io", "photocraft-ipp", - "photocraft-ml", "photocraft-ops", "photocraft-paint", "photocraft-plugins", @@ -5125,20 +5057,6 @@ dependencies = [ name = "photocraft-ipp" version = "0.15.1" -[[package]] -name = "photocraft-ml" -version = "0.15.1" -dependencies = [ - "ort", - "photocraft-algo", - "photocraft-raster", - "serde", - "sha2", - "tempfile", - "thiserror 2.0.21", - "ureq", -] - [[package]] name = "photocraft-ops" version = "0.15.1" @@ -5272,7 +5190,6 @@ dependencies = [ "photocraft-geom", "photocraft-gpu", "photocraft-io", - "photocraft-ml", "photocraft-paint", "photocraft-plugins", "photocraft-psd", @@ -5895,12 +5812,6 @@ dependencies = [ "objc2-quartz-core 0.3.2", ] -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - [[package]] name = "rayon" version = "1.12.0" @@ -6969,17 +6880,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "socks" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b" -dependencies = [ - "byteorder", - "libc", - "winapi", -] - [[package]] name = "spin" version = "0.9.9" @@ -7690,9 +7590,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "3.4.2" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a7ac20be9b7726e0bbdbf974c059676d9acb1cd414961f570a4e8231cacd7fc" +checksum = "cde93ff05758a36a851a398a772b0b79a82fbe3c186a46f2696baaeaf84c966b" dependencies = [ "base64 0.23.1", "log", @@ -7700,7 +7600,6 @@ dependencies = [ "rustls", "rustls-pki-types", "rustls-platform-verifier", - "socks", "ureq-proto", "utf8-zero", "webpki-roots", @@ -8412,22 +8311,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - [[package]] name = "winapi-util" version = "0.1.11" @@ -8437,12 +8320,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows" version = "0.62.2" diff --git a/Cargo.toml b/Cargo.toml index efc6c419a4..68d6ae90b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,6 @@ photocraft-vector = { path = "crates/vector" } photocraft-format = { path = "crates/format" } photocraft-automation = { path = "crates/automation" } photocraft-plugins = { path = "crates/plugins" } -photocraft-ml = { path = "crates/ml" } photocraft-engine = { path = "crates/engine" } photocraft-ui-egui = { path = "crates/ui-egui" } photocraft-testkit = { path = "crates/testkit" } @@ -176,3 +175,4 @@ opt-level = "z" opt-level = "z" [profile.wasm-release.package.photocraft-paint] opt-level = 3 + diff --git a/apps/photocraft-cli/Cargo.toml b/apps/photocraft-cli/Cargo.toml index ba333a31c4..94e04b518a 100644 --- a/apps/photocraft-cli/Cargo.toml +++ b/apps/photocraft-cli/Cargo.toml @@ -10,7 +10,6 @@ build = "build.rs" # Open HEIC/HEIF photos (the optional photocraft-heif crate). Not default so distributors choose # it; official builds (CI, packaging/, release) build with `--features heif`. heif = ["photocraft-codecs/heif"] -local-ml = ["photocraft-engine/local-ml"] [lints] workspace = true @@ -45,3 +44,4 @@ clap_mangen = { workspace = true } [build-dependencies] # Icon + VERSIONINFO for photocraft-cli.exe; build.rs only uses it when targeting Windows. winresource = "0.1" + diff --git a/apps/photocraft-cli/src/batch.rs b/apps/photocraft-cli/src/batch.rs index 8547bf6d07..bdaf249bc9 100644 --- a/apps/photocraft-cli/src/batch.rs +++ b/apps/photocraft-cli/src/batch.rs @@ -68,9 +68,6 @@ pub(crate) fn batch(a: &BatchArgs, out: &mut dyn Write, err: &mut dyn Write) -> inputs.sort(); let (mut ok, mut failed) = (0, 0); let mut written = photocraft_engine::file_cmds::OutputClaims::default(); - // Keep only model weights resident across files, rather than retaining their documents or - // loading a new native session for each image in the same explicit batch invocation. - let model_backend = crate::local_headless().session.model_backend; // `--format .jpg` names outputs `.jpg`, as `--format jpg` does (#490). let format = a.export.format.as_deref().map(|f| f.strip_prefix('.').unwrap_or(f)); for input in &inputs { @@ -81,7 +78,6 @@ pub(crate) fn batch(a: &BatchArgs, out: &mut dyn Write, err: &mut dyn Write) -> let r = (|| -> Result> { written.check(&target_text).map_err(CliError::OutputClaimed)?; let mut h = Headless::trusted_local(); - h.session.model_backend = model_backend.clone(); // Steps that play another action find it in the set; the session's playback stack // stops an action that calls itself. h.session.actions.list = set.clone(); @@ -123,7 +119,6 @@ pub(crate) fn droplet(a: &DropletArgs, out: &mut dyn Write, err: &mut dyn Write) p["output"] = json!(o); } let mut s = photocraft_engine::Session::new(); - crate::configure_cli_models(&mut s); let r = s.execute("file.automate.runDroplet", p)?; for f in r["files"].as_array().into_iter().flatten() { let _ = writeln!(out, "ok {}", f.as_str().unwrap_or_default()); diff --git a/apps/photocraft-cli/src/document.rs b/apps/photocraft-cli/src/document.rs index 812f207621..9d730b4635 100644 --- a/apps/photocraft-cli/src/document.rs +++ b/apps/photocraft-cli/src/document.rs @@ -1,7 +1,7 @@ use std::io::Write; use std::path::Path; -use photocraft_automation::files; +use photocraft_automation::{Headless, files}; use serde_json::{Value, json}; use photocraft_engine::type_extra_cmds::missing_font_warnings; @@ -42,7 +42,7 @@ pub(crate) fn convert(a: &ConvertArgs, _out: &mut dyn Write, err: &mut dyn Write pub(crate) fn info(a: &InfoArgs, out: &mut dyn Write) -> Result { let file = &a.file; - let mut h = crate::local_headless(); + let mut h = Headless::trusted_local(); let opened = h.open(file)?; let mut doc = h.inspect(None)?; let mut warnings = opened["warnings"].as_array().cloned().unwrap_or_default(); @@ -74,7 +74,7 @@ fn command_list(a: &RunArgs) -> Result> { pub(crate) fn run_cmds(a: &RunArgs, out: &mut dyn Write, err: &mut dyn Write) -> Result { let opts = ExportOptions::from(&a.export); - let mut h = crate::local_headless(); + let mut h = Headless::trusted_local(); // Opening, running commands and exporting can all notice the same missing font: // one `run` invocation reports each warning line at most once. let mut reported_fonts = std::collections::HashSet::::new(); diff --git a/apps/photocraft-cli/src/lib.rs b/apps/photocraft-cli/src/lib.rs index 006becc8a5..c431b5529f 100644 --- a/apps/photocraft-cli/src/lib.rs +++ b/apps/photocraft-cli/src/lib.rs @@ -68,23 +68,6 @@ where } } -/// Only explicit, trusted CLI invocations receive a model-cache capability. MCP sessions keep -/// their existing filesystem authority; merely starting the CLI never downloads a model. -pub(crate) fn local_headless() -> photocraft_automation::Headless { - let mut h = photocraft_automation::Headless::trusted_local(); - configure_cli_models(&mut h.session); - h -} - -pub(crate) fn configure_cli_models(session: &mut photocraft_engine::Session) { - #[cfg(all(feature = "local-ml", not(target_arch = "wasm32")))] - if let Some(dir) = std::env::var_os("PHOTOCRAFT_MODEL_DIR") { - session.configure_local_models(dir.into()); - } - #[cfg(any(not(feature = "local-ml"), target_arch = "wasm32"))] - let _ = session; -} - #[cfg(test)] pub(crate) mod test_support { /// What [`crate::run`] returned and wrote. diff --git a/apps/photocraft/Cargo.toml b/apps/photocraft/Cargo.toml index cb968142fe..1427efdff2 100644 --- a/apps/photocraft/Cargo.toml +++ b/apps/photocraft/Cargo.toml @@ -11,7 +11,6 @@ build = "build.rs" # Open HEIC/HEIF photos (the optional photocraft-heif crate). Not default so distributors choose # it; official builds (CI, packaging/, release) build with `--features heif`. heif = ["photocraft-codecs/heif"] -local-ml = ["photocraft-engine/local-ml"] [lints] workspace = true diff --git a/apps/photocraft/src/main.rs b/apps/photocraft/src/main.rs index 35781dcf7a..f1086b6a59 100644 --- a/apps/photocraft/src/main.rs +++ b/apps/photocraft/src/main.rs @@ -463,14 +463,6 @@ fn main() -> eframe::Result { }; #[cfg(not(target_os = "linux"))] let session = Session::new(); - #[cfg(feature = "local-ml")] - let session = { - let mut session = session; - if let Some(dir) = services::config_dir() { - session.configure_local_models(dir.join("Models")); - } - session - }; let mut app = PhotocraftApp::new(session, services); app.min_frame_ms = uncapped.then_some(1000.0 / 240.0); app.integrated_titlebar = cfg!(target_os = "macos"); @@ -803,9 +795,9 @@ mod tests { #[test] fn integrations_preferences_decide_the_control_port() { use photocraft_engine::prefs::Integrations; - let off = Integrations { allow_agent_control: false, control_port: 0, ..Default::default() }; - let on = Integrations { allow_agent_control: true, control_port: 0, ..Default::default() }; - let preferred = Integrations { allow_agent_control: true, control_port: 7878, ..Default::default() }; + let off = Integrations { allow_agent_control: false, control_port: 0 }; + let on = Integrations { allow_agent_control: true, control_port: 0 }; + let preferred = Integrations { allow_agent_control: true, control_port: 7878 }; // Nothing asked for, nothing listening. assert_eq!(super::control_port_for(None, &on), (None, None)); @@ -820,11 +812,11 @@ mod tests { let (port, warning) = super::control_port_for(Some(9000), &off); assert_eq!(port, None); assert!(warning.is_some_and(|w| w.contains("Allow Agent Control") && w.contains("9000")), "the refusal names the port"); - let off_with_port = Integrations { allow_agent_control: false, control_port: 7878, ..Default::default() }; + let off_with_port = Integrations { allow_agent_control: false, control_port: 7878 }; assert_eq!(super::control_port_for(None, &off_with_port), (None, None), "off beats a preferred port"); // A port a hand-edited file could hold, outside 1..=65535, is refused and named. - let huge = Integrations { allow_agent_control: true, control_port: 70_000, ..Default::default() }; + let huge = Integrations { allow_agent_control: true, control_port: 70_000 }; let (port, warning) = super::control_port_for(None, &huge); assert_eq!(port, None); assert!(warning.is_some_and(|w| w.contains("70000")), "the refusal names the value"); @@ -875,7 +867,7 @@ mod tests { assert_eq!(r.control_port, 0, "the bad port alone takes its default"); // A bad Allow Agent Control alone takes its default. let r = read(r#"{"integrations":{"allowAgentControl":"no","controlPort":7878}}"#); - assert_eq!(r, photocraft_engine::prefs::Integrations { allow_agent_control: true, control_port: 7878, ..Default::default() }); + assert_eq!(r, photocraft_engine::prefs::Integrations { allow_agent_control: true, control_port: 7878 }); read(r#"{"integrations":{"allowAgentControl":false,"controlPort":-1}}"#); read(r#"{"integrations":{"allowAgentControl":false,"controlPort":4294967296}}"#); read(r#"{"integrations":"off"}"#); diff --git a/contributors/people.toml b/contributors/people.toml index fc9c834219..3fdb201a7f 100644 --- a/contributors/people.toml +++ b/contributors/people.toml @@ -265,9 +265,5 @@ sync_github_name = false [people.drunkeninja42] real_name = "Kushagra Sharma" -[people.mighty-programmer] -real_name = "John Pantrakis" -sync_github_name = true - [people.WebWork-rrs] display_name = "Ratul Paul" diff --git a/crates/automation/src/workspace.rs b/crates/automation/src/workspace.rs index 4460bcb354..e8566b439e 100644 --- a/crates/automation/src/workspace.rs +++ b/crates/automation/src/workspace.rs @@ -297,10 +297,6 @@ pub fn authorize_engine_command(id: &str, params: &Value) -> Result<(), Automati | "layer.videoLayers.newVideoLayerFromFile" | "layer.videoLayers.replaceFootage" | "layer.videoLayers.reloadFrame" - // Downloading (about 1.8 GB) or deleting local models writes the app's model - // folder, outside any workspace; Preferences › Integrations does it for the user. - | "models.download" - | "models.remove" ) || command_uses_ambient_path(id, params) || profile_command_may_read_ambient(id, params) @@ -745,17 +741,6 @@ mod tests { let _ = std::fs::remove_dir(link); } - #[test] - fn local_model_downloads_and_removals_are_not_automation_commands() { - for id in ["models.download", "models.remove"] { - for model in ["birefnet-hr-matting", "sam2.1-large"] { - assert!(authorize_engine_command(id, &serde_json::json!({"id": model})).is_err(), "{id} {model}"); - assert!(authorize_engine_step(id, &serde_json::json!({"id": model})).is_err(), "{id} {model} as an action step"); - } - } - assert!(authorize_engine_command("models.list", &serde_json::json!({})).is_ok()); - } - #[test] fn filesystem_commands_fail_closed() { for id in [ diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml index 2b3f8a23e6..0db3487c56 100644 --- a/crates/engine/Cargo.toml +++ b/crates/engine/Cargo.toml @@ -10,7 +10,6 @@ workspace = true [features] # Real-file corpus tests (opt-in; `cargo xtask test-corpus`). Fail when the corpus is missing. corpus = [] -local-ml = ["photocraft-ml/onnx"] [dependencies] photocraft-geom = { workspace = true } @@ -32,7 +31,6 @@ photocraft-io = { workspace = true } photocraft-psd = { workspace = true } photocraft-format = { workspace = true } photocraft-plugins = { workspace = true } -photocraft-ml = { workspace = true } blake3 = { version = "1.8", default-features = false, features = ["pure"] } photocraft-codecs = { workspace = true } flate2 = { workspace = true } diff --git a/crates/engine/examples/local_models_bench.rs b/crates/engine/examples/local_models_bench.rs deleted file mode 100644 index b6a2e4d55a..0000000000 --- a/crates/engine/examples/local_models_bench.rs +++ /dev/null @@ -1,59 +0,0 @@ -//! Opt-in end-to-end timing on a caller-provided, public-domain 24–36 MP image. No downloads. -//! cargo run --release -p photocraft-engine --features local-ml --example local_models_bench -- -//! /absolute/model-cache /absolute/image.png [/absolute/cutout-directory] -#[cfg(all(feature = "local-ml", not(target_arch = "wasm32")))] -fn main() -> Result<(), Box> { - use photocraft_engine::Session; - use serde_json::json; - let args: Vec = std::env::args().skip(1).collect(); - let cache = args.first().ok_or("provide a model-cache directory")?; - let input = args.get(1).ok_or("provide a public-domain test image")?; - let decoded = photocraft_io::import(input, &photocraft_format::read_file(std::path::Path::new(input))?)?; - if let Some(out) = args.get(2) { - std::fs::create_dir_all(out)?; - } - let mut s = Session::new(); - s.configure_local_models(cache.into()); - s.add_document(decoded.document, None); - let bounds = s.active().ok_or("no document")?.doc.bounds(); - for (command, model) in [ - ("layer.removeBackground", "classical"), - ("layer.removeBackground", "birefnet-hr-matting"), - ("select.object", "classical"), - ("select.object", "sam2.1-large"), - ] { - for run in 0..2 { - let steps = s.active().ok_or("no document")?.history.past_len(); - let params = - json!({"model":model,"rect":[bounds.width() as f32*0.1,bounds.height() as f32*0.05,bounds.width() as f32*0.85,bounds.height() as f32*0.95]}); - let start = std::time::Instant::now(); - let result = s.execute(command, params); - println!( - "{}", - json!({"command":command,"model":model,"run":run,"width":bounds.width(),"height":bounds.height(),"ms":start.elapsed().as_secs_f64()*1000.0,"ok":result.is_ok()}) - ); - result?; - if run == 0 - && let Some(out) = args.get(2) - { - // Turn a selection into a mask for the comparison export; undo separately below. - if command == "select.object" { - s.execute("layer.layerMask.revealSelection", json!({}))?; - } - let d = s.active().ok_or("no document")?; - let export = photocraft_io::export(&d.doc, "comparison.png", &Default::default())?; - let path = std::path::Path::new(out).join(format!("{command}-{model}.png")); - std::fs::write(path, export.bytes)?; - } - while s.active().ok_or("no document")?.history.past_len() > steps { - s.execute("edit.undo", json!({}))?; - } - } - } - Ok(()) -} - -#[cfg(any(not(feature = "local-ml"), target_arch = "wasm32"))] -fn main() { - eprintln!("Enable local-ml on a native target to run this opt-in benchmark."); -} diff --git a/crates/engine/src/commands.rs b/crates/engine/src/commands.rs index fb74a3e9e1..767a9791b0 100644 --- a/crates/engine/src/commands.rs +++ b/crates/engine/src/commands.rs @@ -1505,7 +1505,6 @@ fn build() -> Vec { v.extend(crate::vector_cmds::specs()); v.extend(crate::path_edit_cmds::specs()); v.extend(crate::smartselect_cmds::specs()); - v.extend(crate::model_cmds::specs()); v.extend(crate::cutout_cmds::specs()); v.extend(crate::symmetry_cmds::specs()); v.extend(crate::edit_cmds::specs()); diff --git a/crates/engine/src/cutout_cmds.rs b/crates/engine/src/cutout_cmds.rs index 77ccc31232..3984bc27a8 100644 --- a/crates/engine/src/cutout_cmds.rs +++ b/crates/engine/src/cutout_cmds.rs @@ -55,33 +55,19 @@ fn run(s: &mut Session, p: &Value) -> Result { let sample_all = p.get("sampleAllLayers").and_then(Value::as_bool).unwrap_or(false); let refine = p.get("refine").and_then(Value::as_bool).unwrap_or(true); let area = subject_area(layer, doc.bounds(), sample_all); - let model = crate::model_cmds::subject_model(s, p)?; - let backend = model.map(|_| crate::model_cmds::backend(s)).transpose()?; crate::jobs::edit_job( s, "Remove Background", move |doc, _, ctx| { - let found = match (model, backend.as_ref()) { - (Some(model), Some(backend)) => { - ctx.progress(0.1, "Finding subject"); - with_doc_sampler(doc, Some(id), sample_all, |smp, d| { - crate::model_cmds::infer_region(backend.as_ref(), model, smp, d, photocraft_ml::Prompt::Subject, ctx) - })? - } - // Cancel reaches the min cuts inside Select Subject, so Esc doesn't wait for them. - _ => ctx - .stage(0.1, 0.6, "Finding subject", |ctl| { - with_doc_sampler(doc, Some(id), sample_all, |smp, _| subject::select_subject_with(smp, area, ctl)) - }) - .map_err(|_| EngineError::Cancelled)?, - }; + // Cancel reaches the min cuts inside Select Subject, so Esc doesn't wait for them. + let found = ctx + .stage(0.1, 0.6, "Finding subject", |ctl| with_doc_sampler(doc, Some(id), sample_all, |smp, _| subject::select_subject_with(smp, area, ctl))) + .map_err(|_| EngineError::Cancelled)?; let mut region = found.ok_or_else(|| EngineError::Other("no subject found".into()))?; if ctx.cancelled() { return Err(EngineError::Cancelled); } - // BiRefNet already estimates a soft alpha matte. Classical edge refinement would - // threshold or change those opacities, so it applies only to the classical selector. - if refine && model.is_none() { + if refine { ctx.progress(0.6, "Refining edge"); let refined = with_doc_sampler(doc, Some(id), sample_all, |smp, _| { matting::refine_mask(smp, &matting::region_reader(®ion), region.bbox, area, &REFINE) @@ -98,7 +84,7 @@ fn run(s: &mut Session, p: &Value) -> Result { let b = region.bbox; Ok([b.x0, b.y0, b.width() as i32, b.height() as i32]) }, - move |bounds| json!({ "layer": id.0, "bounds": bounds, "model": model.map_or("classical", |m| m.name()) }), + move |bounds| json!({ "layer": id.0, "bounds": bounds }), ) } @@ -109,7 +95,7 @@ pub fn specs() -> Vec { label: "Remove Background", menu: &[], shortcut: None, - params: r##"{"layer":id?,"sampleAllLayers":bool=false,"refine":bool=true,"model":"classical|birefnet-hr-matting"?} → {layer,bounds,model} (model defaults to Preferences; refine applies to classical only; replaces the layer mask; the Background becomes a normal layer)"##, + params: r##"{"layer":id?,"sampleAllLayers":bool=false,"refine":bool=true} → {layer,bounds} (adds a layer mask from Select Subject; the Background becomes a normal layer)"##, enabled, run, journal: true, diff --git a/crates/engine/src/file_cmds.rs b/crates/engine/src/file_cmds.rs index 9cb368db2f..261e3d8608 100644 --- a/crates/engine/src/file_cmds.rs +++ b/crates/engine/src/file_cmds.rs @@ -1489,18 +1489,12 @@ fn batch(s: &mut Session, p: &Value) -> Result { let names = batch_naming::plan(&inputs, &output, &format, p)?; let save = SaveOpts::from_params(s, p, cmd)?; let authorize = s.authorize; - // Reuse a host-granted backend (and its resident model) across inputs. A default or - // untrusted session still has no model-cache capability; nested steps retain its gate. - let model_backend = s.model_backend.clone(); - let integrations = s.prefs().integrations.clone(); // Each input runs in its own scratch session, so what the played steps spend is carried from // one input to the next (failed or not) and back to this session, not restarted per input. let carried = std::cell::Cell::new(playback_steps); let carried = &carried; let run = move |scratch: &mut Session, out: &str| { scratch.authorize = authorize; - scratch.model_backend = model_backend.clone(); - scratch.edit_prefs(|p| p.integrations = integrations.clone()); scratch.actions = actions.clone(); scratch.actions.playback_steps = carried.get(); let result = (|| { diff --git a/crates/engine/src/float_cmds.rs b/crates/engine/src/float_cmds.rs index 9ee34dcdf2..763051a962 100644 --- a/crates/engine/src/float_cmds.rs +++ b/crates/engine/src/float_cmds.rs @@ -334,7 +334,7 @@ pub fn drop_floating(s: &mut Session) -> Result { /// Commands that leave a floating piece floating: its own, and ones that don't touch documents. fn keeps_floating(id: &str) -> bool { matches!(id, "select.float" | "select.drop" | "brush.mixer.sample" | "brush.mixer.load" | "brush.mixer.clean") - || ["view.", "window.", "help.", "prefs.", "models."].iter().any(|p| id.starts_with(p)) + || ["view.", "window.", "help.", "prefs."].iter().any(|p| id.starts_with(p)) } /// Before any command (`Session::dispatch`): Undo puts a floating piece back (and is used up: diff --git a/crates/engine/src/jobs.rs b/crates/engine/src/jobs.rs index f29b588737..aba588841b 100644 --- a/crates/engine/src/jobs.rs +++ b/crates/engine/src/jobs.rs @@ -324,7 +324,7 @@ pub enum Started { /// Commands that never edit the active document, allowed while a job runs on it. fn independent_of_document(id: &str) -> bool { - const PREFIXES: &[&str] = &["jobs.", "models.", "tools.", "view.", "window.", "help.", "brush.presets.", "gradient.presets."]; + const PREFIXES: &[&str] = &["jobs.", "tools.", "view.", "window.", "help.", "brush.presets.", "gradient.presets."]; const IDS: &[&str] = &["file.new", "file.close", "file.closeAll", "edit.preferences", "edit.colorSettings", "edit.keyboardShortcuts", "edit.menus"]; PREFIXES.iter().any(|p| id.starts_with(p)) || IDS.contains(&id) } @@ -797,7 +797,6 @@ impl Session { if let Some(v) = crate::float_cmds::before_command(self, id)? { return Ok(Started::Done(v)); } - let params = crate::model_cmds::inject_model(self, id, params); // Pixel commands follow the Channels panel target unless the caller names one. let run_params = self.admit(id, spec, ¶ms)?; // This UI-only disclosure preference applies to both `execute` and `start`: diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 6ad9a0b90c..914604f219 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -82,7 +82,6 @@ pub mod magnetic_cmds; pub mod mask_view_cmds; mod migrate_cmds; pub mod mode_cmds; -pub mod model_cmds; pub mod multichannel_cmds; pub mod new_layer; pub mod notes_cmds; @@ -504,9 +503,6 @@ pub struct Session { pub prefs: prefs::PrefsStore, /// Release checks use an injected platform transport; no network I/O in the engine. pub updates: updates_cmds::Updates, - /// Optional native model service, injected by a platform frontend. An ordinary/test/web - /// session has none: creating a Session never downloads models or accesses a model directory. - pub model_backend: Option>, /// Edit menu state: Fade source, custom shape library (see `edit_menu_cmds`). pub edit_state: edit_menu_cmds::EditState, /// The pattern library (Window › Patterns; see `pattern.*`). diff --git a/crates/engine/src/model_cmds.rs b/crates/engine/src/model_cmds.rs deleted file mode 100644 index 0472117b14..0000000000 --- a/crates/engine/src/model_cmds.rs +++ /dev/null @@ -1,611 +0,0 @@ -//! Optional model lifecycle commands and the colour/depth-agnostic selection adapter. -use std::sync::Arc; - -use photocraft_algo::segment::{Sampler, antialias_u8, trim_region}; -use photocraft_algo::selection::Region; -use photocraft_cms::{Builtin, Transform, transform::TransformOptions}; -use photocraft_doc::Document; -use photocraft_geom::Rect; -use photocraft_ml::{InferenceBackend, MaskKind, ModelId, Prompt}; -use serde_json::{Value, json}; - -use crate::commands::CommandSpec; -use crate::jobs::JobCtx; -use crate::{EngineError, Result, Session}; - -fn error(e: photocraft_ml::Error) -> EngineError { - match e { - photocraft_ml::Error::Cancelled => EngineError::Cancelled, - e => EngineError::Other(e.to_string()), - } -} - -pub(crate) fn backend(s: &Session) -> Result> { - s.model_backend - .clone() - .ok_or_else(|| EngineError::Other("local models are not available in this build or session; choose Classical in Preferences › Integrations".into())) -} - -/// An explicit command choice overrides the saved preference, allowing an action or script to -/// request the same method every time. Inference never silently falls back or starts a download. -pub(crate) fn subject_model(s: &Session, p: &Value) -> Result> { - model_choice(p, saved(s, s.prefs().integrations.subject_model.name()), ModelId::BiRefNet) -} - -pub(crate) fn object_model(s: &Session, p: &Value) -> Result> { - model_choice(p, saved(s, s.prefs().integrations.object_model.name()), ModelId::Sam2) -} - -/// The saved choice. Default and web builds can't run a model and hide the choice, so one saved -/// by a build with local models (the preferences file is shared) means Classical there instead of -/// failing every Select Subject. Builds with local models keep it strict; explicit params too. -fn saved(s: &Session, name: &'static str) -> &'static str { - if crate::prefs::NATIVE_MODELS || s.model_backend.is_some() { name } else { "classical" } -} - -/// Resolve the preference before dispatch so recorded actions keep the method used, even if -/// the preference changes before playback. Explicit choices (including invalid ones) stay intact. -pub(crate) fn inject_model(s: &Session, command: &str, mut params: Value) -> Value { - let model = match command { - "select.subject" | "layer.removeBackground" => saved(s, s.prefs().integrations.subject_model.name()), - // Point clicks commit the built-in Object Finder's hover result. SAM supports boxes, - // so record Classical for this route even when the saved box preference is SAM. - "select.object" if params.get("rect").is_none() && params.get("point").is_some() => "classical", - "select.object" => saved(s, s.prefs().integrations.object_model.name()), - _ => return params, - }; - if params.is_null() { - params = json!({}); - } - if let Some(fields) = params.as_object_mut() { - fields.entry("model").or_insert_with(|| json!(model)); - } - params -} - -fn model_choice(p: &Value, default: &str, allowed: ModelId) -> Result> { - let name = match p.get("model") { - Some(v) => v.as_str().ok_or_else(|| EngineError::Other("model must be a string".into()))?, - None => default, - }; - if name == "classical" { - return Ok(None); - } - match ModelId::parse(name) { - Some(id) if id == allowed => Ok(Some(id)), - _ => Err(EngineError::Other(format!("model must be classical or {} for this command", allowed.name()))), - } -} - -struct ModelSampler<'a> { - source: &'a dyn Sampler, - cmyk: Option>, - transform: Arc, -} - -impl Sampler for ModelSampler<'_> { - fn rgba(&self, rect: Rect) -> Vec<[f32; 4]> { - // rgb_scaled reads strips on rayon workers. Enter the document's CMYK context on each - // worker, and convert its RGB/gray profile before downsampling or compositing transparency. - let mut px = photocraft_color::convert::with_cmyk_space(self.cmyk.as_ref(), || self.source.rgba(rect)); - for p in &mut px { - let mut rgb = [0.0; 3]; - self.transform.eval(&p[..3], &mut rgb); - for (dst, v) in p.iter_mut().take(3).zip(rgb) { - *dst = if v.is_finite() { v.clamp(0.0, 1.0) } else { 0.0 }; - } - p[3] = if p[3].is_finite() { p[3].clamp(0.0, 1.0) } else { 0.0 }; - } - px - } -} - -pub(crate) fn infer_region( - backend: &dyn InferenceBackend, - id: ModelId, - source: &dyn Sampler, - doc: &Document, - prompt: Prompt, - ctx: &JobCtx, -) -> Result> { - let bounds = doc.bounds(); - let (w, h) = (bounds.width() as usize, bounds.height() as usize); - let n = w - .checked_mul(h) - .filter(|n| *n > 0 && *n <= 64_000_000) - .ok_or_else(|| EngineError::Other("local models currently support canvases up to 64 megapixels".into()))?; - ctx.check()?; - ctx.progress(0.02, "Preparing image"); - let transform = photocraft_cms::transform::cached(&crate::color_cmds::composite_profile(doc), Builtin::Srgb.profile(), TransformOptions::default()) - .map_err(|e| EngineError::Other(format!("model colour conversion: {e}")))?; - let sampler = ModelSampler { source, cmyk: photocraft_compose::cmyk_space(doc), transform }; - let step = w.max(h).div_ceil(id.info().input_side).max(1); - let image = sampler.rgb_scaled(bounds, step); - ctx.check()?; - ctx.progress(0.1, "Running local model (CPU)"); - let mask = ctx.stage(0.1, 0.85, "Running local model (CPU)", |ctl| backend.infer(id, &image, prompt, ctl)).map_err(error)?; - mask.validate().map_err(error)?; - let mut values = vec![0u8; n]; - for (y, row) in values.chunks_exact_mut(w).enumerate() { - ctx.check()?; - for (x, dst) in row.iter_mut().enumerate() { - *dst = mask.coverage((x as f32 + 0.5) / w as f32, (y as f32 + 0.5) / h as f32); - } - if y % 64 == 0 { - ctx.progress(0.85 + 0.14 * y as f32 / h as f32, "Building mask"); - } - } - if mask.kind == MaskKind::Logits { - antialias_u8(&mut values, w, h); - } - ctx.check()?; - Ok(trim_region(Region { bbox: bounds, mask: values })) -} - -impl Session { - /// Inject a native model cache. Host code supplies the location; no arbitrary model path or - /// URL is accepted by an engine command. Default builds and wasm have no native backend. - #[cfg(all(feature = "local-ml", not(target_arch = "wasm32")))] - pub fn configure_local_models(&mut self, directory: std::path::PathBuf) { - self.model_backend = Some(Arc::new(photocraft_ml::NativeBackend::new(directory))); - } - - pub fn local_model_status(&self) -> Value { - let states = self.model_backend.as_ref().map(|b| b.status()).unwrap_or_default(); - let models: Vec = photocraft_ml::MODELS - .iter() - .map(|m| { - let status = states.iter().find(|s| s.id == m.id); - json!({"id": m.id, "label": m.label, "purpose": m.purpose, "license": m.license, - "downloadBytes": m.download_bytes(), "upstream": m.upstream, "exportSource": m.export_source, - "revision": m.revision, "installed": status.is_some_and(|s| s.installed), "busy": status.is_some_and(|s| s.busy)}) - }) - .collect(); - json!({"available": self.model_backend.is_some(), "models": models}) - } -} - -fn model_id(p: &Value, cmd: &str) -> Result { - p.get("id") - .and_then(Value::as_str) - .and_then(ModelId::parse) - .ok_or_else(|| EngineError::BadParams { cmd: cmd.into(), msg: "id must be birefnet-hr-matting or sam2.1-large".into() }) -} - -fn available(s: &Session) -> std::result::Result<(), String> { - if s.model_backend.is_some() { Ok(()) } else { Err("local models are not available in this build or session".into()) } -} - -fn download(s: &mut Session, p: &Value) -> Result { - let id = model_id(p, "models.download")?; - let backend = backend(s)?; - crate::jobs::run( - s, - &format!("Downloading {}", id.info().label), - false, - move |ctx| ctx.stage(0.0, 1.0, "Downloading model", |ctl| backend.download(id, ctl)).map_err(error), - move |s, ()| Ok(s.local_model_status()), - ) -} - -fn remove(s: &mut Session, p: &Value) -> Result { - let id = model_id(p, "models.remove")?; - let backend = backend(s)?; - crate::jobs::run( - s, - &format!("Removing {}", id.info().label), - false, - move |ctx| ctx.stage(0.0, 1.0, "Removing model", |ctl| backend.remove(id, ctl)).map_err(error), - move |s, ()| { - s.prefs.edit(|p| match id { - ModelId::BiRefNet => p.integrations.subject_model = crate::prefs::SubjectModel::Classical, - ModelId::Sam2 => p.integrations.object_model = crate::prefs::ObjectModel::Classical, - }); - Ok(s.local_model_status()) - }, - ) -} - -pub fn specs() -> Vec { - vec![ - CommandSpec { - id: "models.list", - label: "Local Selection Models", - menu: &[], - shortcut: None, - params: "{} → {available,models:[{id,label,installed,busy,downloadBytes,license,revision,upstream,exportSource}]}", - enabled: |_| Ok(()), - run: |s, _| Ok(s.local_model_status()), - journal: false, - }, - CommandSpec { - id: "models.download", - label: "Download Local Selection Model", - menu: &[], - shortcut: None, - params: r#"{"id":"birefnet-hr-matting|sam2.1-large"} (explicit download; size/SHA-256 verified; no document edits)"#, - enabled: available, - run: download, - journal: false, - }, - CommandSpec { - id: "models.remove", - label: "Remove Local Selection Model", - menu: &[], - shortcut: None, - params: r#"{"id":"birefnet-hr-matting|sam2.1-large"} (remove only this model; restore its selection preference to classical)"#, - enabled: available, - run: remove, - journal: false, - }, - ] -} - -#[cfg(test)] -mod tests { - use super::*; - use photocraft_algo::segment::RgbImage; - use photocraft_ml::{AlphaMask, ModelStatus}; - use photocraft_raster::Interrupt; - use std::sync::Mutex; - use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; - - #[derive(Default)] - struct Fake { - installed: AtomicBool, - downloads: AtomicUsize, - block: AtomicBool, - entered: AtomicBool, - calls: Mutex>, - } - impl InferenceBackend for Fake { - fn status(&self) -> Vec { - photocraft_ml::MODELS.iter().map(|m| ModelStatus { id: m.id, installed: self.installed.load(Ordering::Relaxed), busy: false }).collect() - } - fn download(&self, _: ModelId, _: &Interrupt<'_>) -> photocraft_ml::Result<()> { - self.downloads.fetch_add(1, Ordering::Relaxed); - self.installed.store(true, Ordering::Relaxed); - Ok(()) - } - fn remove(&self, _: ModelId, _: &Interrupt<'_>) -> photocraft_ml::Result<()> { - self.installed.store(false, Ordering::Relaxed); - Ok(()) - } - fn infer(&self, id: ModelId, image: &RgbImage, prompt: Prompt, ctl: &Interrupt<'_>) -> photocraft_ml::Result { - self.entered.store(true, Ordering::Relaxed); - if !self.installed.load(Ordering::Relaxed) { - return Err(photocraft_ml::Error::Unavailable("download first".into())); - } - self.calls.lock().unwrap().push((id, RgbImage { w: image.w, h: image.h, px: image.px.clone() }, prompt)); - if self.block.load(Ordering::Relaxed) { - for _ in 0..400 { - if ctl.cancelled() { - return Err(photocraft_ml::Error::Cancelled); - } - std::thread::sleep(std::time::Duration::from_millis(5)); - } - return Err(photocraft_ml::Error::Inference("test backend timed out".into())); - } - Ok(AlphaMask { width: 2, height: 1, values: vec![0.0, 1.0], kind: MaskKind::Alpha }) - } - } - fn session(mode: &str, depth: u32) -> (Session, Arc) { - let mut s = Session::new(); - s.execute("file.new", json!({"width":8,"height":4,"depth":depth,"mode":mode})).unwrap(); - let fake = Arc::new(Fake::default()); - fake.installed.store(true, Ordering::Relaxed); - s.model_backend = Some(fake.clone()); - (s, fake) - } - fn cov(s: &Session, x: i32) -> f32 { - s.active().unwrap().doc.selection.as_ref().map_or(0.0, |m| m.sample_channel(x, 2, 0)) - } - fn pixels(s: &Session) -> Vec { - let d = s.active().unwrap(); - d.doc.layer(d.active_layer.unwrap()).unwrap().surface().unwrap().read_region(d.doc.bounds()) - } - - #[test] - fn learned_background_mask_preserves_pixels_soft_alpha_and_one_undo_at_all_depths_and_modes() { - for mode in ["rgb", "gray", "cmyk", "lab"] { - for depth in [8, 16, 32] { - let (mut s, fake) = session(mode, depth); - s.execute("select.rect", json!({"x":0,"y":0,"width":2,"height":4})).unwrap(); - let old_selection = s.active().unwrap().doc.selection.clone(); - let before = pixels(&s); - let steps = s.active().unwrap().history.past_len(); - s.execute("layer.removeBackground", json!({"model":"birefnet-hr-matting"})).unwrap(); - let d = s.active().unwrap(); - let mask = d.doc.layer(d.active_layer.unwrap()).unwrap().mask.as_ref().unwrap(); - assert_eq!(mask.value(0, 2), 0.0); - assert_eq!(mask.value(7, 2), 1.0); - assert!((mask.value(3, 2) - 0.376).abs() < 0.01); - assert_eq!(pixels(&s), before, "{mode} {depth}"); - assert!(d.doc.selection.is_none()); - assert_eq!(d.history.past_len(), steps + 1); - let calls = fake.calls.lock().unwrap(); - assert_eq!((calls[0].1.w, calls[0].1.h), (8, 4)); - assert!(calls[0].1.px.iter().flatten().all(|v| v.is_finite() && (0.0..=1.0).contains(v))); - drop(calls); - s.execute("edit.undo", json!({})).unwrap(); - let d = s.active().unwrap(); - assert!(d.doc.layer(d.active_layer.unwrap()).unwrap().mask.is_none()); - assert_eq!(d.doc.selection.as_ref().unwrap().read_region(d.doc.bounds()), old_selection.as_ref().unwrap().read_region(d.doc.bounds())); - s.execute("edit.redo", json!({})).unwrap(); - assert!(s.active().unwrap().doc.layers[0].mask.is_some()); - } - } - } - - #[test] - fn learned_selection_combines_modes_and_maps_boxes_on_non_square_images() { - for (mode, left, right) in [("replace", false, true), ("add", true, true), ("subtract", true, false), ("intersect", false, false)] { - let (mut s, fake) = session("rgb", 16); - s.execute("select.rect", json!({"x":0,"y":0,"width":2,"height":4})).unwrap(); - let steps = s.active().unwrap().history.past_len(); - s.execute("select.object", json!({"rect":[6,3,-4,-2],"model":"sam2.1-large","mode":mode})).unwrap(); - assert_eq!(cov(&s, 0) > 0.5, left, "{mode}"); - assert_eq!(cov(&s, 7) > 0.5, right, "{mode}"); - let calls = fake.calls.lock().unwrap(); - assert_eq!(calls[0].2, Prompt::Box([0.25, 0.25, 0.75, 0.75])); - drop(calls); - assert_eq!(s.active().unwrap().history.past_len(), steps + 1); - s.execute("edit.undo", json!({})).unwrap(); - assert_eq!(cov(&s, 0), 1.0); - assert_eq!(cov(&s, 7), 0.0); - } - } - - #[test] - fn missing_models_invalid_choices_and_bad_boxes_never_edit_or_download() { - let (mut s, fake) = session("rgb", 8); - fake.installed.store(false, Ordering::Relaxed); - let revision = s.active().unwrap().revision; - for (cmd, p) in [ - ("select.subject", json!({"model":"birefnet-hr-matting"})), - ("layer.removeBackground", json!({"model":"birefnet-hr-matting"})), - ("select.object", json!({"model":"sam2.1-large","rect":[0,0,8,4]})), - ("select.subject", json!({"model":"sam2.1-large"})), - ("select.subject", json!({"model":42})), - ("models.download", json!({"id":"../unsafe"})), - ("models.remove", json!({"id":42})), - ] { - assert!(s.execute(cmd, p).is_err(), "{cmd}"); - } - for rect in [json!([0, 0, "bad", 8, 4]), json!([0, 0, 8]), json!([1e100, 0, 8, 4]), json!([0, 0, 0, 0]), json!([100, 100, 8, 4])] { - assert!(s.execute("select.object", json!({"model":"sam2.1-large","rect":rect})).is_err()); - } - assert_eq!(s.active().unwrap().revision, revision); - assert_eq!(fake.downloads.load(Ordering::Relaxed), 0); - s.model_backend = None; - assert_eq!(s.execute("models.list", json!({})).unwrap()["available"], false); - assert!(s.execute("select.subject", json!({"model":"birefnet-hr-matting"})).is_err()); - } - - #[test] - fn a_model_saved_by_a_local_ml_build_means_classical_in_a_build_without_models() { - if crate::prefs::NATIVE_MODELS { - return; - } - let mut s = Session::new(); - s.execute("file.new", json!({"width":8,"height":4,"depth":8,"mode":"rgb"})).unwrap(); - s.execute("prefs.set", json!({"path":"integrations.subjectModel","value":"birefnet-hr-matting"})).unwrap(); - s.execute("prefs.set", json!({"path":"integrations.objectModel","value":"sam2.1-large"})).unwrap(); - s.execute("actions.record", json!({"name":"Saved"})).unwrap(); - for (cmd, p) in [("select.subject", json!({})), ("select.object", json!({"rect":[0,0,8,4]})), ("layer.removeBackground", json!({}))] { - let r = s.execute(cmd, p); - assert!(!matches!(&r, Err(EngineError::Other(m)) if m.contains("local models")), "{cmd}: {r:?}"); - } - s.execute("actions.stop", json!({})).unwrap(); - let steps = &s.actions.list[0].steps; - assert!(!steps.is_empty()); - assert!(steps.iter().all(|(_, p)| p["model"] == "classical"), "{steps:?}"); - // Asking for a model by name still fails: only the saved choice falls back. - assert!(s.execute("select.subject", json!({"model":"birefnet-hr-matting"})).is_err()); - } - - #[test] - fn downloads_need_no_document_never_replay_and_removal_resets_only_its_preference() { - let mut s = Session::new(); - let fake = Arc::new(Fake::default()); - s.model_backend = Some(fake.clone()); - s.execute("models.download", json!({"id":"birefnet-hr-matting"})).unwrap(); - assert!(s.journal.is_empty()); - assert_eq!(fake.downloads.load(Ordering::Relaxed), 1); - s.execute("prefs.set", json!({"values":{"integrations.subjectModel":"birefnet-hr-matting","integrations.objectModel":"sam2.1-large"}})).unwrap(); - s.execute("models.remove", json!({"id":"birefnet-hr-matting"})).unwrap(); - assert_eq!(s.prefs().integrations.subject_model, crate::prefs::SubjectModel::Classical); - assert_eq!(s.prefs().integrations.object_model, crate::prefs::ObjectModel::Sam2); - assert!(s.execute("prefs.set", json!({"path":"integrations.objectModel","value":"birefnet-hr-matting"})).is_err()); - let mut old = s.prefs_value(); - old["integrations"].as_object_mut().unwrap().remove("objectModel"); - old["integrations"].as_object_mut().unwrap().remove("subjectModel"); - let loaded: crate::prefs::Preferences = serde_json::from_value(old).unwrap(); - assert_eq!(loaded.integrations.subject_model, crate::prefs::SubjectModel::Classical); - assert_eq!(loaded.integrations.object_model, crate::prefs::ObjectModel::Classical); - } - - #[test] - fn managing_models_does_not_drop_a_floating_selection_or_edit_the_document() { - let (mut s, _) = session("rgb", 8); - s.execute("layer.new.layer", json!({})).unwrap(); - s.edit("paint", |doc, layer| { - let bounds = doc.bounds(); - doc.layer_mut(layer.unwrap()).unwrap().surface_mut().unwrap().fill_rect(bounds, &[1.0, 0.0, 0.0, 1.0]); - Ok(()) - }) - .unwrap(); - s.execute("select.rect", json!({"x":0,"y":0,"width":2,"height":2})).unwrap(); - s.execute("select.float", json!({"dx":2,"dy":1})).unwrap(); - let doc = s.active().unwrap().doc.clone(); - let history = s.active().unwrap().history.past_len(); - let journal = s.journal.len(); - for (command, params) in - [("models.list", json!({})), ("models.download", json!({"id":"birefnet-hr-matting"})), ("models.remove", json!({"id":"birefnet-hr-matting"}))] - { - s.execute(command, params).unwrap(); - let state = s.active().unwrap(); - assert!(Arc::ptr_eq(&state.doc, &doc)); - assert_eq!(state.history.past_len(), history); - assert_eq!(state.floating.as_ref().unwrap().offset, (2, 1)); - assert_eq!(s.journal.len(), journal); - } - } - - #[test] - fn preferences_select_a_model_and_explicit_classical_overrides_it() { - let (mut s, fake) = session("rgb", 32); - s.execute("prefs.set", json!({"path":"integrations.subjectModel","value":"birefnet-hr-matting"})).unwrap(); - s.execute("select.subject", json!({})).unwrap(); - assert_eq!(fake.calls.lock().unwrap().len(), 1); - s.execute("select.subject", json!({"model":"classical"})).unwrap(); - assert_eq!(fake.calls.lock().unwrap().len(), 1); - } - - #[test] - fn learned_subject_runs_independently_of_the_classical_result_cache() { - let (mut s, fake) = session("rgb", 16); - s.execute("select.subject", json!({"model":"classical"})).unwrap(); - s.edit_prefs(|p| p.integrations.subject_model = crate::prefs::SubjectModel::BiRefNet); - for expected_calls in 1..=2 { - let result = s.execute("select.subject", json!({})).unwrap(); - assert_eq!(result["model"], "birefnet-hr-matting"); - assert_eq!(fake.calls.lock().unwrap().len(), expected_calls); - assert_eq!(cov(&s, 0), 0.0); - assert_eq!(cov(&s, 7), 1.0); - } - s.execute("select.subject", json!({"model":"classical"})).unwrap(); - assert_eq!(fake.calls.lock().unwrap().len(), 2); - } - - #[test] - fn recorded_actions_keep_the_selected_method_when_preferences_change() { - let (mut s, fake) = session("rgb", 8); - s.edit_prefs(|p| { - p.integrations.subject_model = crate::prefs::SubjectModel::BiRefNet; - p.integrations.object_model = crate::prefs::ObjectModel::Sam2; - }); - s.execute("actions.record", json!({"name":"Models"})).unwrap(); - s.execute("select.subject", Value::Null).unwrap(); - s.execute("select.object", json!({"rect":[0,0,8,4]})).unwrap(); - s.execute("layer.removeBackground", json!({})).unwrap(); - s.execute("actions.stop", json!({})).unwrap(); - let action = &s.actions.list[0]; - assert_eq!(action.steps.len(), 3); - assert_eq!(action.steps[0].1["model"], "birefnet-hr-matting"); - assert_eq!(action.steps[1].1["model"], "sam2.1-large"); - assert_eq!(action.steps[2].1["model"], "birefnet-hr-matting"); - s.edit_prefs(|p| p.integrations = Default::default()); - assert!(s.execute("actions.play", json!({"action":"Models"})).unwrap().get("failed").is_none()); - assert_eq!(fake.calls.lock().unwrap().len(), 6); - } - - #[test] - #[cfg(not(target_arch = "wasm32"))] - fn batch_and_droplet_share_only_the_explicitly_configured_model_capability() { - let dir = std::env::temp_dir().join(format!("photocraft-model-batch-{}", std::process::id())); - let _ = std::fs::remove_dir_all(&dir); - std::fs::create_dir(&dir).unwrap(); - let input = dir.join("input.png"); - let output = dir.join("output"); - std::fs::create_dir(&output).unwrap(); - let (mut s, fake) = session("rgb", 8); - let exported = photocraft_io::export(&s.active().unwrap().doc, "input.png", &Default::default()).unwrap(); - std::fs::write(&input, exported.bytes).unwrap(); - s.edit_prefs(|p| p.integrations.subject_model = crate::prefs::SubjectModel::BiRefNet); - let droplet = dir.join("models.pcdroplet"); - std::fs::write( - &droplet, - serde_json::to_vec(&json!({"photocraftDroplet":1,"action":{"steps":[["layer.removeBackground",{}]]},"options":{"format":"png"}})).unwrap(), - ) - .unwrap(); - let result = s.execute("file.automate.runDroplet", json!({"droplet":droplet,"input":[input],"output":output})).unwrap(); - assert_eq!(result["errors"], json!([])); - assert_eq!(fake.calls.lock().unwrap().len(), 1); - // Current upstream supports called actions in batch. Keep that action list alongside - // the host-granted backend and method preference; losing either breaks this call. - s.actions.list.push(crate::actions_cmds::Action::new("Models", vec![("select.subject".into(), json!({}))])); - let called_action = json!({"steps":[["actions.play",{"action":"Models"}]],"input":[input],"output":output}); - let result = s.execute("file.automate.batch", called_action.clone()).unwrap(); - assert_eq!(result["errors"], json!([]), "{result}"); - assert_eq!(result["files"].as_array().unwrap().len(), 1); - assert_eq!(fake.calls.lock().unwrap().len(), 2); - s.model_backend = None; - let result = s.execute("file.automate.batch", called_action).unwrap(); - if crate::prefs::NATIVE_MODELS { - assert_eq!(result["files"], json!([]), "a called action cannot grant a model backend"); - assert_eq!(result["errors"].as_array().unwrap().len(), 1); - } else { - // A build without local models reads the saved model as Classical. - assert_eq!(result["errors"], json!([]), "{result}"); - } - assert_eq!(fake.calls.lock().unwrap().len(), 2); - let result = - s.execute("file.automate.batch", json!({"steps":[["select.subject",{"model":"birefnet-hr-matting"}]],"input":[input],"output":output})).unwrap(); - assert_eq!(result["errors"].as_array().unwrap().len(), 1); - assert_eq!(fake.calls.lock().unwrap().len(), 2); - std::fs::remove_dir_all(dir).unwrap(); - } - - #[test] - fn model_input_uses_document_profile_and_existing_mask_replacement_undo_is_preserved() { - let (mut s, fake) = session("rgb", 32); - s.edit("linear pixels and old mask", |doc, _| { - doc.icc_profile = Some(Builtin::LinearSrgb.profile().to_bytes()); - let bounds = doc.bounds(); - doc.layers[0].surface_mut().unwrap().fill_rect(bounds, &[0.25, 0.25, 0.25, 1.0]); - doc.layers[0].mask = Some(photocraft_doc::LayerMask::hide_all()); - Ok(()) - }) - .unwrap(); - s.execute("select.subject", json!({"model":"birefnet-hr-matting","sampleAllLayers":false})).unwrap(); - let calls = fake.calls.lock().unwrap(); - assert!((calls[0].1.px[0][0] - 0.5371).abs() < 0.005, "linear RGB must be transformed to sRGB"); - drop(calls); - s.execute("layer.removeBackground", json!({"model":"birefnet-hr-matting"})).unwrap(); - assert_eq!(s.active().unwrap().doc.layers[0].mask.as_ref().unwrap().value(7, 2), 1.0); - s.execute("edit.undo", json!({})).unwrap(); - assert_eq!(s.active().unwrap().doc.layers[0].mask.as_ref().unwrap().value(7, 2), 0.0); - } - - #[test] - fn out_of_range_and_non_finite_alpha_only_affect_the_model_input() { - // The existing segmentation sampler composites transparent pixels over neutral gray. - for (alpha, expected) in [(2.0, 0.25), (f32::NAN, 0.5)] { - let (mut s, fake) = session("rgb", 32); - s.edit("HDR alpha", |doc, _| { - doc.icc_profile = Some(Builtin::Srgb.profile().to_bytes()); - let bounds = doc.bounds(); - doc.layers[0].surface_mut().unwrap().fill_rect(bounds, &[0.25, 0.25, 0.25, alpha]); - Ok(()) - }) - .unwrap(); - let before: Vec = pixels(&s).iter().map(|v| v.to_bits()).collect(); - s.execute("select.subject", json!({"model":"birefnet-hr-matting","sampleAllLayers":false})).unwrap(); - assert_eq!(pixels(&s).iter().map(|v| v.to_bits()).collect::>(), before); - assert!(fake.calls.lock().unwrap()[0].1.px.iter().flatten().all(|v| v.is_finite() && (*v - expected).abs() < 0.005)); - } - } - - #[test] - #[cfg(not(target_arch = "wasm32"))] - fn cancelling_model_inference_discards_result_and_unlocks_document() { - let (mut s, fake) = session("rgb", 8); - fake.block.store(true, Ordering::Relaxed); - let before = s.active().unwrap().revision; - let crate::jobs::Started::Job(job) = s.start("layer.removeBackground", json!({"model":"birefnet-hr-matting"})).unwrap() else { panic!("expected job") }; - for _ in 0..200 { - if fake.entered.load(Ordering::Relaxed) { - break; - } - std::thread::sleep(std::time::Duration::from_millis(5)); - } - assert!(fake.entered.load(Ordering::Relaxed)); - assert!(s.cancel_job(job)); - assert!(matches!(s.wait_job(job), Err(EngineError::Cancelled))); - assert_eq!(s.active().unwrap().revision, before); - assert!(s.active().unwrap().doc.layers[0].mask.is_none()); - s.execute("select.all", json!({})).unwrap(); - assert!(s.active().unwrap().doc.selection.is_some()); - } -} diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs index ef101473a9..8133e3c2c5 100644 --- a/crates/engine/src/prefs.rs +++ b/crates/engine/src/prefs.rs @@ -120,8 +120,6 @@ choice!( /// fastest and softest. Photoshop's Camera Raw has no such choice. RawDemosaic { Ahd = "ahd", Mhc = "mhc", Bilinear = "bilinear" } default Ahd ); -choice!(SubjectModel { Classical = "classical", BiRefNet = "birefnet-hr-matting" } default Classical); -choice!(ObjectModel { Classical = "classical", Sam2 = "sam2.1-large" } default Classical); impl Unit { /// Document pixels → this unit. `dpi` is the document resolution, `extent` the 100% length @@ -975,14 +973,11 @@ pub struct Integrations { pub allow_agent_control: bool, /// Default control port (0 = only when `--control` is given). pub control_port: u32, - /// Optional, downloaded local model; classical selection remains the default. - pub subject_model: SubjectModel, - pub object_model: ObjectModel, } impl Default for Integrations { fn default() -> Self { - Self { allow_agent_control: true, control_port: 0, subject_model: SubjectModel::Classical, object_model: ObjectModel::Classical } + Self { allow_agent_control: true, control_port: 0 } } } @@ -1175,16 +1170,9 @@ pub const HIDDEN_UNTIL_IMPLEMENTED: &[&str] = &[ /// Is the preference at `path` (`"section.key"`) hidden from the Preferences dialog? pub fn is_hidden(path: &str) -> bool { - HIDDEN_UNTIL_IMPLEMENTED.contains(&path) || (!cfg!(target_os = "linux") && LINUX_ONLY.contains(&path)) || (!NATIVE_MODELS && LOCAL_ML_ONLY.contains(&path)) + HIDDEN_UNTIL_IMPLEMENTED.contains(&path) || (!cfg!(target_os = "linux") && LINUX_ONLY.contains(&path)) } -/// Whether this build can run local models (the `local-ml` feature, native only). -pub const NATIVE_MODELS: bool = cfg!(all(feature = "local-ml", not(target_arch = "wasm32"))); - -/// Model choices; builds without local models don't show them (#204). A choice saved by a build -/// with them (the preferences file is shared) still round-trips, and means Classical here. -pub const LOCAL_ML_ONLY: &[&str] = &["integrations.subjectModel", "integrations.objectModel"]; - /// Preferences that only do something on Linux; the dialog doesn't show them elsewhere. They /// still load, save and round-trip on every platform. pub const LINUX_ONLY: &[&str] = &["performance.linuxDisplayServer", "performance.gpuAdapter"]; @@ -1236,8 +1224,6 @@ pub fn choices(path: &str) -> Option<&'static [&'static str]> { "performance.gpuBackend" => GpuBackend::NAMES, "performance.linuxDisplayServer" => LinuxDisplayServer::NAMES, "performance.renderingMode" => RenderingMode::NAMES, - "integrations.subjectModel" => SubjectModel::NAMES, - "integrations.objectModel" => ObjectModel::NAMES, _ => return None, }) } diff --git a/crates/engine/src/smartselect_cmds.rs b/crates/engine/src/smartselect_cmds.rs index b9f31d6e22..cfd1b333e0 100644 --- a/crates/engine/src/smartselect_cmds.rs +++ b/crates/engine/src/smartselect_cmds.rs @@ -74,7 +74,7 @@ pub(crate) fn with_doc_sampler(doc: &Document, layer: Option, all_la /// caller gets `changed: false`, whatever the mode. (Select Subject and Object Selection run /// heuristics that often find nothing on busy photos; clearing the selection then looks like /// a dead button.) -pub(crate) fn apply(s: &mut Session, label: &str, region: Option<&Region>, m: SelectionMode) -> Result { +fn apply(s: &mut Session, label: &str, region: Option<&Region>, m: SelectionMode) -> Result { if region.is_none() { // Nothing found: leave the selection (and history) alone. let selected = s.active().ok_or(EngineError::NoDocument)?.doc.selection.is_some(); @@ -121,16 +121,13 @@ fn quick_selection(s: &mut Session, p: &Value) -> Result { fn rect_param(p: &Value) -> Option { let a = p.get("rect")?.as_array()?; - let v: Vec = a.iter().map(Value::as_f64).collect::>()?; - if v.len() != 4 || v.iter().any(|v| !v.is_finite()) { + let v: Vec = a.iter().filter_map(Value::as_f64).collect(); + if v.len() < 4 { return None; } // Negative sizes (dragging up/left) are normalised. let (x0, x1) = (v[0].min(v[0] + v[2]), v[0].max(v[0] + v[2])); let (y0, y1) = (v[1].min(v[1] + v[3]), v[1].max(v[1] + v[3])); - if [x0, y0, x1, y1].iter().any(|v| !v.is_finite() || *v < i32::MIN as f64 || *v > i32::MAX as f64) { - return None; - } Some(Rect::new(x0.floor() as i32, y0.floor() as i32, x1.ceil() as i32, y1.ceil() as i32)) } @@ -270,30 +267,12 @@ fn object_selection(s: &mut Session, p: &Value) -> Result { if p.get("rect").is_none() && let Some(pt) = point_param(p) { - if crate::model_cmds::object_model(s, p)?.is_some() { - return Err(bad("select.object", "SAM Object Selection needs a rectangle; point clicks use the Classical Object Finder")); - } return object_at_point(s, p, pt); } let rect = rect_param(p).ok_or_else(|| bad("select.object", "needs \"rect\": [x, y, w, h] or \"point\": [x, y]"))?; let all_layers = b(p, "sampleAllLayers", false); let d = s.active().ok_or(EngineError::NoDocument)?; check_sampled_pixels(&d.doc, d.active_layer, all_layers, rect)?; - if let Some(id) = crate::model_cmds::object_model(s, p)? { - let d = s.active().ok_or(EngineError::NoDocument)?; - let canvas = d.doc.bounds(); - let rect = rect.intersect(&canvas); - if rect.is_empty() { - return Err(bad("select.object", "box must overlap the canvas")); - } - let prompt = photocraft_ml::Prompt::Box([ - (rect.x0 - canvas.x0) as f32 / canvas.width() as f32, - (rect.y0 - canvas.y0) as f32 / canvas.height() as f32, - (rect.x1 - canvas.x0) as f32 / canvas.width() as f32, - (rect.y1 - canvas.y0) as f32 / canvas.height() as f32, - ]); - return model_selection(s, p, id, prompt, "Object Selection", false); - } let region = with_sampler(s, all_layers, |smp, doc| grabcut::object_select(smp, doc.bounds(), rect, 160_000))?; apply(s, "Object Selection", region.as_ref(), mode(p, "replace")) } @@ -324,9 +303,6 @@ impl SubjectCache { } fn select_subject(s: &mut Session, p: &Value) -> Result { - if let Some(id) = crate::model_cmds::subject_model(s, p)? { - return model_selection(s, p, id, photocraft_ml::Prompt::Subject, "Select Subject", true); - } let all_layers = b(p, "sampleAllLayers", true); let d = s.active().ok_or(EngineError::NoDocument)?; // What `with_doc_sampler` samples: the active layer's pixels, else the composite. @@ -353,31 +329,6 @@ fn select_subject(s: &mut Session, p: &Value) -> Result { Ok(out) } -fn model_selection( - s: &mut Session, - p: &Value, - id: photocraft_ml::ModelId, - prompt: photocraft_ml::Prompt, - label: &'static str, - all_default: bool, -) -> Result { - let backend = crate::model_cmds::backend(s)?; - let d = s.active().ok_or(EngineError::NoDocument)?; - let (doc, layer) = (d.doc.clone(), d.active_layer); - let (all, m) = (b(p, "sampleAllLayers", all_default), mode(p, "replace")); - crate::jobs::run( - s, - label, - true, - move |ctx| with_doc_sampler(&doc, layer, all, |smp, d| crate::model_cmds::infer_region(backend.as_ref(), id, smp, d, prompt, ctx)), - move |s, region| { - let mut result = apply(s, label, region.as_ref(), m)?; - result["model"] = json!(id); - Ok(result) - }, - ) -} - fn focus_area(s: &mut Session, p: &Value) -> Result { let (range, noise) = (f(p, "range", 0.5).clamp(0.0, 1.0), f(p, "noise", 0.0).clamp(0.0, 1.0)); let region = with_sampler(s, b(p, "sampleAllLayers", true), |smp, doc| focus::focus_area(smp, doc.bounds(), range, noise))?; @@ -584,7 +535,7 @@ pub fn specs() -> Vec { "select.object", "Object Selection", [], - r##"{"rect":[x,y,w,h] | "point":[x,y],"mode":"replace|add|subtract|intersect"="replace","sampleAllLayers":bool=false,"model":"classical|sam2.1-large"? (box defaults to Preferences; point uses Classical Object Finder)}"##, + r##"{"rect":[x,y,w,h] | "point":[x,y],"mode":"replace|add|subtract|intersect"="replace","sampleAllLayers":bool=false} (point: the Object Finder's object under the point, as hovering previews it)"##, has_doc, object_selection ), @@ -592,7 +543,7 @@ pub fn specs() -> Vec { "select.subject", "Subject", ["Select"], - r##"{"sampleAllLayers":bool=true,"mode":"replace|add|subtract|intersect"="replace","model":"classical|birefnet-hr-matting"? (defaults to Preferences)}"##, + r##"{"sampleAllLayers":bool=true,"mode":"replace|add|subtract|intersect"="replace"}"##, has_doc, select_subject ), @@ -788,27 +739,6 @@ mod tests { } } - #[test] - fn object_finder_point_actions_remain_classical_with_a_sam_box_preference() { - let (mut s, inside) = disc(16); - s.edit_prefs(|p| p.integrations.object_model = crate::prefs::ObjectModel::Sam2); - s.execute("actions.record", json!({"name":"Object Finder"})).unwrap(); - s.execute("select.object", json!({"point":[100,80]})).unwrap(); - s.execute("actions.stop", json!({})).unwrap(); - assert!(sel_iou(&s, 200, 160, &inside) > 0.9); - assert_eq!(s.actions.list[0].steps[0].1["model"], "classical"); - s.execute("select.deselect", json!({})).unwrap(); - assert!(s.execute("actions.play", json!({"action":"Object Finder"})).unwrap().get("failed").is_none()); - assert!(sel_iou(&s, 200, 160, &inside) > 0.9); - let before = s.active().unwrap().doc.clone(); - let history = s.active().unwrap().history.past_len(); - for model in [json!("sam2.1-large"), json!("unknown"), json!(42)] { - assert!(s.execute("select.object", json!({"point":[100,80],"model":model})).is_err()); - assert!(std::sync::Arc::ptr_eq(&before, &s.active().unwrap().doc)); - assert_eq!(s.active().unwrap().history.past_len(), history); - } - } - #[test] fn object_selection_point_honours_the_modes() { let (mut s, _) = disc(8); diff --git a/crates/ml/Cargo.toml b/crates/ml/Cargo.toml deleted file mode 100644 index cd64710423..0000000000 --- a/crates/ml/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "photocraft-ml" -version.workspace = true -edition.workspace = true -license.workspace = true - -[lints] -workspace = true - -[features] -default = [] -# Native C++ runtime at the I/O edge; never enabled by default or linked into wasm. -onnx = ["dep:ort", "dep:ureq", "dep:sha2", "dep:tempfile"] - -[dependencies] -photocraft-algo = { workspace = true } -photocraft-raster = { workspace = true } -serde = { workspace = true } -thiserror = { workspace = true } - -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -# Pin prereleases: the API and matching native runtime must be reviewed together. -ort = { version = "=2.0.0-rc.13", default-features = false, features = ["std", "api-27", "download-binaries", "tls-rustls"], optional = true } -# Pinned because the idle-timeout transport adapter uses ureq's unversioned seam. -ureq = { version = "=3.4.2", default-features = false, features = ["rustls"], optional = true } -sha2 = { version = "0.10", optional = true } -tempfile = { version = "3", optional = true } diff --git a/crates/ml/README.md b/crates/ml/README.md deleted file mode 100644 index 3dcc9abf0a..0000000000 --- a/crates/ml/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# photocraft-ml - -L4 boundary for optional local image segmentation. The default crate contains a pinned model -catalogue, image/mask validation and an `InferenceBackend` trait. The `onnx` Cargo feature adds -the native CPU backend using the safe `ort` API. It never links ONNX Runtime into wasm. - -Hosts inject a cache directory. Constructing a backend, querying its status, opening an image -or selecting a method never downloads anything. Only `download` contacts the pinned export -URLs. Downloads stream into a temporary directory, verify exact sizes and SHA-256 hashes, and -install by rename after every artifact succeeds. Failure/cancellation discards staging files. -Inference re-verifies artifacts before parsing; arbitrary model paths and URLs are not commands. - -One model's weights stay resident at a time. CPU arena and memory-pattern caching are disabled -to release large temporary tensors between runs instead of retaining peak allocations. -Per-model locks protect download/removal/inference, and a -shared session lock prevents two large inferences from running together. CPU runs use up to eight -threads; `RunOptions::terminate` handles cancellation. Slow session construction finishes before -the next cancellation check. Stalled HTTP reads time out after 30 seconds, separately from the -one-hour total body budget. `ureq` is pinned because its idle-timeout adapter uses the unversioned -transport seam without changing the default TLS/proxy connector. - -`RgbImage` inputs must already be sRGB; the engine converts the document profile through CMS. -Inputs are mapped to the training square with bilinear interpolation and ImageNet-normalized -NCHW. BiRefNet's reviewed export returns sigmoid alpha directly; SAM returns logits, with the -best predicted-IoU mask chosen and thresholding after interpolation. Box prompts share the -full-image normalized coordinates. `AlphaMask::coverage` supplies the existing selection/mask -coverage representation while source pixels retain their original depth and colour mode. - -See [local models](../../docs/local-models.md) for UI/CLI usage, limitations, exact provenance, -licences and reproducible checks. Tiny original synthetic ONNX graphs in `src/test_models.rs` -test the runtime contracts offline; they contain no learned weights and make no accuracy claim. diff --git a/crates/ml/licenses/BiRefNet-MIT.txt b/crates/ml/licenses/BiRefNet-MIT.txt deleted file mode 100644 index 485921e827..0000000000 --- a/crates/ml/licenses/BiRefNet-MIT.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 ZhengPeng - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/crates/ml/licenses/ONNXRuntime-MIT.txt b/crates/ml/licenses/ONNXRuntime-MIT.txt deleted file mode 100644 index 48bc6bb499..0000000000 --- a/crates/ml/licenses/ONNXRuntime-MIT.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/crates/ml/licenses/ONNXRuntime-ThirdPartyNotices.txt b/crates/ml/licenses/ONNXRuntime-ThirdPartyNotices.txt deleted file mode 100644 index fbd9f9a95f..0000000000 --- a/crates/ml/licenses/ONNXRuntime-ThirdPartyNotices.txt +++ /dev/null @@ -1,6121 +0,0 @@ -THIRD PARTY SOFTWARE NOTICES AND INFORMATION - -Do Not Translate or Localize - -This software incorporates material from third parties. Microsoft makes certain -open source code available at http://3rdpartysource.microsoft.com, or you may -send a check or money order for US $5.00, including the product name, the open -source component name, and version number, to: - -Source Code Compliance Team -Microsoft Corporation -One Microsoft Way -Redmond, WA 98052 -USA - -Notwithstanding any other terms, you may reverse engineer this software to the -extent required to debug changes to any libraries licensed under the GNU Lesser -General Public License. - -_____ - -Intel Math Kernel Library (Intel MKL) - -Intel Simplified Software License (Version April 2018) - -Copyright (c) 2018 Intel Corporation. - -Use and Redistribution. You may use and redistribute the software (the “Software”), without modification, -provided the following conditions are met: - -* Redistributions must reproduce the above copyright notice and the following terms of use in the Software -and in the documentation and/or other materials provided with the distribution. - -* Neither the name of Intel nor the names of its suppliers may be used to endorse or promote products -derived from this Software without specific prior written permission. - -* No reverse engineering, decompilation, or disassembly of this Software is permitted. - -Limited patent license. Intel grants you a world-wide, royalty-free, non-exclusive license under patents it now -or hereafter owns or controls to make, have made, use, import, offer to sell and sell (“Utilize”) this Software, -but solely to the extent that any such patent is necessary to Utilize the Software alone. The patent license -shall not apply to any combinations which include this software. No hardware per se is licensed hereunder. - -Third party and other Intel programs. “Third Party Programs” are the files listed in the “third-party-programs.txt” -text file that is included with the Software and may include Intel programs under separate license terms. -Third Party Programs, even if included with the distribution of the Materials, are governed by -separate license terms and those license terms solely govern your use of those programs. - -DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE DISCLAIMED. THIS SOFTWARE IS -NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS WHERE FAILURE OF THE SOFTWARE -MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE THAT YOU ARE FULLY RESPONSIBLE FOR ANY -CLAIMS, COSTS, DAMAGES, EXPENSES, AND ATTORNEYS’ FEES ARISING OUT OF ANY SUCH USE, -EVEN IF ANY CLAIM ALLEGES THAT INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF -THE MATERIALS. - -LIMITATION OF LIABILITY. IN NO EVENT WILL INTEL BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. YOU AGREE TO INDEMNIFY AND HOLD INTEL HARMLESS AGAINST ANY CLAIMS -AND EXPENSES RESULTING FROM YOUR USE OR UNAUTHORIZED USE OF THE SOFTWARE. - -No support. Intel may make changes to the Software, at any time without notice, and is not obligated to -support, update or provide training for the Software. - -Termination. Intel may terminate your right to use the Software in the event of your breach of this Agreement -and you fail to cure the breach within a reasonable period of time. - -Feedback. Should you provide Intel with comments, modifications, corrections, enhancements or other input -(“Feedback”) related to the Software Intel will be free to use, disclose, reproduce, license or otherwise -distribute or exploit the Feedback in its sole discretion without any obligations or restrictions of any kind, -including without limitation, intellectual property rights or licensing obligations. - -Compliance with laws. You agree to comply with all relevant laws and regulations governing your use, -transfer, import or export (or prohibition thereof) of the Software. - -Governing law. All disputes will be governed by the laws of the United States of America and the State of -Delaware without reference to conflict of law principles and subject to the exclusive jurisdiction of the state or -federal courts sitting in the State of Delaware, and each party agrees that it submits to the personal -jurisdiction and venue of those courts and waives any objections. The United Nations Convention on -Contracts for the International Sale of Goods (1980) is specifically excluded and will not apply to the -Software. - -*Other names and brands may be claimed as the property of others. - -_____ - -protocolbuffers/protobuf - -Copyright 2008 Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Code generated by the Protocol Buffer compiler is owned by the owner -of the input file used when generating it. This code is not -standalone and requires a support library to be linked with it. This -support library is itself covered by the above license. - -_____ - -madler/zlib - -The deflate format used by zlib was defined by Phil Katz. The deflate and -zlib specifications were written by L. Peter Deutsch. Thanks to all the -people who reported problems and suggested various improvements in zlib; they -are too numerous to cite here. - -Copyright notice: - - (C) 1995-2017 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* receiving -lengthy legal documents to sign. The sources are provided for free but without -warranty of any kind. The library has been entirely written by Jean-loup -Gailly and Mark Adler; it does not include third-party code. - -If you redistribute modified sources, we would appreciate that you include in -the file ChangeLog history information documenting your changes. Please read -the FAQ for more information on the distribution of modified source versions. - -_____ - -pybind/pybind11 - -Copyright (c) 2016 Wenzel Jakob , All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Please also refer to the file CONTRIBUTING.md, which clarifies licensing of -external contributions to this project including patches, pull requests, etc. - -_____ - -onnx -Open Neural Network Exchange - -Copyright (c) Facebook, Inc. and Microsoft Corporation. All rights reserved. - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -_____ - -Eigen - -MPL v2.0 -Mozilla Public License Version 2.0 - - -================================== - -1. Definitions - --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions - --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities - -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination - --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. - -_____ - -intel/dnnl - -Copyright 2016-2018 Intel Corporation - -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -sub-components: - -xbyak - -Copyright (c) 2007 MITSUNARI Shigeo. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. -Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -Neither the name of the copyright owner nor the names of its contributors may -be used to endorse or promote products derived from this software without -specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - -_____ - -Microsoft GSL - -Copyright (c) 2015 Microsoft Corporation. All rights reserved. - -This code is licensed under the MIT License (MIT). - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -_____ - -Tensorflow - -Copyright 2018 The TensorFlow Authors. All rights reserved. - -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, -and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by -the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all -other entities that control, are controlled by, or are under common -control with that entity. For the purposes of this definition, -"control" means (i) the power, direct or indirect, to cause the -direction or management of such entity, whether by contract or -otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity -exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, -including but not limited to software source code, documentation -source, and configuration files. - -"Object" form shall mean any form resulting from mechanical -transformation or translation of a Source form, including but -not limited to compiled object code, generated documentation, -and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or -Object form, made available under the License, as indicated by a -copyright notice that is included in or attached to the work -(an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object -form, that is based on (or derived from) the Work and for which the -editorial revisions, annotations, elaborations, or other modifications -represent, as a whole, an original work of authorship. For the purposes -of this License, Derivative Works shall not include works that remain -separable from, or merely link (or bind by name) to the interfaces of, -the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including -the original version of the Work and any modifications or additions -to that Work or Derivative Works thereof, that is intentionally -submitted to Licensor for inclusion in the Work by the copyright owner -or by an individual or Legal Entity authorized to submit on behalf of -the copyright owner. For the purposes of this definition, "submitted" -means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, -and issue tracking systems that are managed by, or on behalf of, the -Licensor for the purpose of discussing and improving the Work, but -excluding communication that is conspicuously marked or otherwise -designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity -on behalf of whom a Contribution has been received by Licensor and -subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of -this License, each Contributor hereby grants to You a perpetual, -worldwide, non-exclusive, no-charge, royalty-free, irrevocable -copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the -Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of -this License, each Contributor hereby grants to You a perpetual, -worldwide, non-exclusive, no-charge, royalty-free, irrevocable -(except as stated in this section) patent license to make, have made, -use, offer to sell, sell, import, and otherwise transfer the Work, -where such license applies only to those patent claims licensable -by such Contributor that are necessarily infringed by their -Contribution(s) alone or by combination of their Contribution(s) -with the Work to which such Contribution(s) was submitted. If You -institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work -or a Contribution incorporated within the Work constitutes direct -or contributory patent infringement, then any patent licenses -granted to You under this License for that Work shall terminate -as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the -Work or Derivative Works thereof in any medium, with or without -modifications, and in Source or Object form, provided that You -meet the following conditions: - -(a) You must give any other recipients of the Work or -Derivative Works a copy of this License; and - -(b) You must cause any modified files to carry prominent notices -stating that You changed the files; and - -(c) You must retain, in the Source form of any Derivative Works -that You distribute, all copyright, patent, trademark, and -attribution notices from the Source form of the Work, -excluding those notices that do not pertain to any part of -the Derivative Works; and - -(d) If the Work includes a "NOTICE" text file as part of its -distribution, then any Derivative Works that You distribute must -include a readable copy of the attribution notices contained -within such NOTICE file, excluding those notices that do not -pertain to any part of the Derivative Works, in at least one -of the following places: within a NOTICE text file distributed -as part of the Derivative Works; within the Source form or -documentation, if provided along with the Derivative Works; or, -within a display generated by the Derivative Works, if and -wherever such third-party notices normally appear. The contents -of the NOTICE file are for informational purposes only and -do not modify the License. You may add Your own attribution -notices within Derivative Works that You distribute, alongside -or as an addendum to the NOTICE text from the Work, provided -that such additional attribution notices cannot be construed -as modifying the License. - -You may add Your own copyright statement to Your modifications and -may provide additional or different license terms and conditions -for use, reproduction, or distribution of Your modifications, or -for any such Derivative Works as a whole, provided Your use, -reproduction, and distribution of the Work otherwise complies with -the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, -any Contribution intentionally submitted for inclusion in the Work -by You to the Licensor shall be under the terms and conditions of -this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify -the terms of any separate license agreement you may have executed -with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade -names, trademarks, service marks, or product names of the Licensor, -except as required for reasonable and customary use in describing the -origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or -agreed to in writing, Licensor provides the Work (and each -Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -implied, including, without limitation, any warranties or conditions -of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A -PARTICULAR PURPOSE. You are solely responsible for determining the -appropriateness of using or redistributing the Work and assume any -risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, -whether in tort (including negligence), contract, or otherwise, -unless required by applicable law (such as deliberate and grossly -negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, -incidental, or consequential damages of any character arising as a -result of this License or out of the use or inability to use the -Work (including but not limited to damages for loss of goodwill, -work stoppage, computer failure or malfunction, or any and all -other commercial damages or losses), even if such Contributor -has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing -the Work or Derivative Works thereof, You may choose to offer, -and charge a fee for, acceptance of support, warranty, indemnity, -or other liability obligations and/or rights consistent with this -License. However, in accepting such obligations, You may act only -on Your own behalf and on Your sole responsibility, not on behalf -of any other Contributor, and only if You agree to indemnify, -defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason -of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2017, The TensorFlow Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -_____ - -Microsoft Cognitive Toolkit (CNTK) - -Copyright (c) Microsoft Corporation. All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, -merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -_____ - -NumPy License - -Copyright (c) 2005, NumPy Developers - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the NumPy Developers nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -_____ - -Pytorch / Caffe2 - -From PyTorch: - -Copyright (c) 2016- Facebook, Inc (Adam Paszke) -Copyright (c) 2014- Facebook, Inc (Soumith Chintala) -Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert) -Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu) -Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu) -Copyright (c) 2011-2013 NYU (Clement Farabet) -Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston) -Copyright (c) 2006 Idiap Research Institute (Samy Bengio) -Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz) - -From Caffe2: - -Copyright (c) 2016-present, Facebook Inc. All rights reserved. - -All contributions by Facebook: -Copyright (c) 2016 Facebook Inc. - -All contributions by Google: -Copyright (c) 2015 Google Inc. -All rights reserved. - -All contributions by Yangqing Jia: -Copyright (c) 2015 Yangqing Jia -All rights reserved. - -All contributions from Caffe: -Copyright(c) 2013, 2014, 2015, the respective contributors -All rights reserved. - -All other contributions: -Copyright(c) 2015, 2016 the respective contributors -All rights reserved. - -Caffe2 uses a copyright model similar to Caffe: each contributor holds -copyright over their contributions to Caffe2. The project versioning records -all such contribution and copyright details. If a contributor wants to further -mark their specific copyright on a particular contribution, they should -indicate their copyright solely in the commit message of the change when it is -committed. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the names of Facebook, Deepmind Technologies, NYU, NEC Laboratories America - and IDIAP Research Institute nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -_____ - -Caffe - -COPYRIGHT - -All contributions by the University of California: -Copyright (c) 2014-2017 The Regents of the University of California (Regents) -All rights reserved. - -All other contributions: -Copyright (c) 2014-2017, the respective contributors -All rights reserved. - -Caffe uses a shared copyright model: each contributor holds copyright over -their contributions to Caffe. The project versioning records all such -contribution and copyright details. If a contributor wants to further mark -their specific copyright on a particular contribution, they should indicate -their copyright solely in the commit message of the change when it is -committed. - -LICENSE - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -CONTRIBUTION AGREEMENT - -By contributing to the BVLC/caffe repository through pull-request, comment, -or otherwise, the contributor releases their content to the -license and copyright terms herein. - -_____ - -The LLVM Compiler Infrastructure - -============================================================================== -LLVM Release License -============================================================================== -University of Illinois/NCSA -Open Source License - -Copyright (c) 2003-2017 University of Illinois at Urbana-Champaign. -All rights reserved. - -Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - -============================================================================== -Copyrights and Licenses for Third Party Software Distributed with LLVM: -============================================================================== -The LLVM software contains code written by third parties. Such software will -have its own individual LICENSE.TXT file in the directory in which it appears. -This file will describe the copyrights, license, and restrictions which apply -to that code. - -The disclaimer of warranty in the University of Illinois Open Source License -applies to all code in the LLVM Distribution, and nothing in any of the -other licenses gives permission to use the names of the LLVM Team or the -University of Illinois to endorse or promote products derived from this -Software. - -The following pieces of software have additional or alternate copyrights, -licenses, and/or restrictions: - -Program Directory -------- --------- -Google Test llvm/utils/unittest/googletest -OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex} -pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT} -ARM contributions llvm/lib/Target/ARM/LICENSE.TXT -md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h - -_____ - -google/benchmark - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -CONTRIBUTORS - -# People who have agreed to one of the CLAs and can contribute patches. -# The AUTHORS file lists the copyright holders; this file -# lists people. For example, Google employees are listed here -# but not in AUTHORS, because Google holds the copyright. -# -# Names should be added to this file only after verifying that -# the individual or the individual's organization has agreed to -# the appropriate Contributor License Agreement, found here: -# -# https://developers.google.com/open-source/cla/individual -# https://developers.google.com/open-source/cla/corporate -# -# The agreement for individuals can be filled out on the web. -# -# When adding J Random Contributor's name to this file, -# either J's name or J's organization's name should be -# added to the AUTHORS file, depending on whether the -# individual or corporate CLA was used. -# -# Names should be added to this file as: -# Name -# -# Please keep the list sorted. - -Albert Pretorius -Arne Beer -Billy Robert O'Neal III -Chris Kennelly -Christopher Seymour -David Coeurjolly -Deniz Evrenci -Dominic Hamon -Dominik Czarnota -Eric Fiselier -Eugene Zhuk -Evgeny Safronov -Federico Ficarelli -Felix Homann -Ismael Jimenez Martinez -Jern-Kuan Leong -JianXiong Zhou -Joao Paulo Magalhaes -John Millikin -Jussi Knuuttila -Kai Wolf -Kishan Kumar -Kaito Udagawa -Lei Xu -Matt Clarkson -Maxim Vafin -Nick Hutchinson -Oleksandr Sochka -Pascal Leroy -Paul Redmond -Pierre Phaneuf -Radoslav Yovchev -Raul Marin -Ray Glover -Robert Guo -Roman Lebedev -Shuo Chen -Tobias Ulvgård -Tom Madams -Yixuan Qiu -Yusuke Suzuki -Zbigniew Skowron - -AUTHORS - -# This is the official list of benchmark authors for copyright purposes. -# This file is distinct from the CONTRIBUTORS files. -# See the latter for an explanation. -# -# Names should be added to this file as: -# Name or Organization -# The email address is not required for organizations. -# -# Please keep the list sorted. - -Albert Pretorius -Arne Beer -Carto -Christopher Seymour -David Coeurjolly -Deniz Evrenci -Dirac Research -Dominik Czarnota -Eric Fiselier -Eugene Zhuk -Evgeny Safronov -Federico Ficarelli -Felix Homann -Google Inc. -International Business Machines Corporation -Ismael Jimenez Martinez -Jern-Kuan Leong -JianXiong Zhou -Joao Paulo Magalhaes -Jussi Knuuttila -Kaito Udagawa -Kishan Kumar -Lei Xu -Matt Clarkson -Maxim Vafin -MongoDB Inc. -Nick Hutchinson -Oleksandr Sochka -Paul Redmond -Radoslav Yovchev -Roman Lebedev -Shuo Chen -Steinar H. Gunderson -Stripe, Inc. -Yixuan Qiu -Yusuke Suzuki -Zbigniew Skowron - -_____ - -HalideIR - -Copyright (c) 2016 HalideIR contributors -Copyright (c) 2012-2014 MIT CSAIL, Google Inc., and other contributors -HalideIR is derived from the Halide project. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -_____ - -Distributed Machine Learning Common Codebase - -Copyright (c) 2015 by Contributors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -_____ - -DLPack: Open In Memory Tensor Structure - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2017 by Contributors - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -_____ - -HowardHinnant/date - -The source code in this project is released using the MIT License. There is no -global license for the project because each file is licensed individually with -different author names and/or dates. - -If you contribute to this project, please add your name to the license of each -file you modify. If you have already contributed to this project and forgot to -add your name to the license, please feel free to submit a new P/R to add your -name to the license in each file you modified. - -For convenience, here is a copy of the MIT license found in each file except -without author names or dates: - -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -_____ - -FreeBSD: getopt.c file - -Copyright (c) 1987, 1993, 1994 -The Regents of the University of California. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. Neither the name of the University nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. -_____ - - -google/googletest - -Copyright 2008, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -_____ - -G3log : Asynchronous logger with Dynamic Sinks - -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to -_____ - -Scikit-learn - -Copyright (c) 2007–2018 The scikit-learn developers. -All rights reserved. - - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - a. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - b. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - c. Neither the name of the Scikit-learn Developers nor the names of - its contributors may be used to endorse or promote products - derived from this software without specific prior written - permission. - - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. - -_____ - -google/re2 - -Copyright (c) 2009 The RE2 Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -_____ -onnx/onnx-tensorrt - -MIT License - -Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. -Copyright (c) 2018 Open Neural Network Exchange - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -_____ -nvidia/cutlass - -Copyright (c) 2017 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -SPDX-License-Identifier: BSD-3-Clause - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -_____ -Boost - -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - - -_____ - -JDAI-CV/DNNLibrary - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [2019] [JD.com Inc. JD AI] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -_____ - -google/flatbuffers - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -_____ - -google/glog - -Copyright (c) 2008, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -A function gettimeofday in utilities.cc is based on - -http://www.google.com/codesearch/p?hl=en#dR3YEbitojA/COPYING&q=GetSystemTimeAsFileTime%20license:bsd - -The license of this code is: - -Copyright (c) 2003-2008, Jouni Malinen and contributors -All Rights Reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name(s) of the above-listed copyright holder(s) nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -_____ - -abseil-cpp -https://github.com/abseil/abseil-cpp - - Apache License - Version 2.0, January 2004 - https://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -_____ - -microsoft/wil - -MIT License - -Copyright (c) Microsoft Corporation. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE - -_____ - -nlohmann/json - -MIT License - -Copyright (c) 2013-2019 Niels Lohmann - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -_____ - -dcleblanc/SafeInt - -MIT License - -Copyright (c) 2018 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -_____ -Open MPI - -3-Clause BSD License - -Most files in this release are marked with the copyrights of the -organizations who have edited them. The copyrights below are in no -particular order and generally reflect members of the Open MPI core -team who have contributed code to this release. The copyrights for -code used under license from other parties are included in the -corresponding files. - -Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana - University Research and Technology - Corporation. All rights reserved. -Copyright (c) 2004-2017 The University of Tennessee and The University - of Tennessee Research Foundation. All rights - reserved. -Copyright (c) 2004-2010 High Performance Computing Center Stuttgart, - University of Stuttgart. All rights reserved. -Copyright (c) 2004-2008 The Regents of the University of California. - All rights reserved. -Copyright (c) 2006-2017 Los Alamos National Security, LLC. All rights - reserved. -Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved. -Copyright (c) 2006-2010 Voltaire, Inc. All rights reserved. -Copyright (c) 2006-2017 Sandia National Laboratories. All rights reserved. -Copyright (c) 2006-2010 Sun Microsystems, Inc. All rights reserved. - Use is subject to license terms. -Copyright (c) 2006-2017 The University of Houston. All rights reserved. -Copyright (c) 2006-2009 Myricom, Inc. All rights reserved. -Copyright (c) 2007-2017 UT-Battelle, LLC. All rights reserved. -Copyright (c) 2007-2017 IBM Corporation. All rights reserved. -Copyright (c) 1998-2005 Forschungszentrum Juelich, Juelich Supercomputing - Centre, Federal Republic of Germany -Copyright (c) 2005-2008 ZIH, TU Dresden, Federal Republic of Germany -Copyright (c) 2007 Evergrid, Inc. All rights reserved. -Copyright (c) 2008 Chelsio, Inc. All rights reserved. -Copyright (c) 2008-2009 Institut National de Recherche en - Informatique. All rights reserved. -Copyright (c) 2007 Lawrence Livermore National Security, LLC. - All rights reserved. -Copyright (c) 2007-2017 Mellanox Technologies. All rights reserved. -Copyright (c) 2006-2010 QLogic Corporation. All rights reserved. -Copyright (c) 2008-2017 Oak Ridge National Labs. All rights reserved. -Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved. -Copyright (c) 2009-2015 Bull SAS. All rights reserved. -Copyright (c) 2010 ARM ltd. All rights reserved. -Copyright (c) 2016 ARM, Inc. All rights reserved. -Copyright (c) 2010-2011 Alex Brick . All rights reserved. -Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights - reserved. -Copyright (c) 2013-2016 Intel, Inc. All rights reserved. -Copyright (c) 2011-2017 NVIDIA Corporation. All rights reserved. -Copyright (c) 2016 Broadcom Limited. All rights reserved. -Copyright (c) 2011-2017 Fujitsu Limited. All rights reserved. -Copyright (c) 2014-2015 Hewlett-Packard Development Company, LP. All - rights reserved. -Copyright (c) 2013-2017 Research Organization for Information Science (RIST). - All rights reserved. -Copyright (c) 2017-2018 Amazon.com, Inc. or its affiliates. All Rights - reserved. -Copyright (c) 2018 DataDirect Networks. All rights reserved. -Copyright (c) 2018-2019 Triad National Security, LLC. All rights reserved. - -$COPYRIGHT$ - -Additional copyrights may follow - -$HEADER$ - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -- Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer listed - in this license in the documentation and/or other materials - provided with the distribution. - -- Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -The copyright holders provide no reassurances that the source code -provided does not infringe any patent, copyright, or any other -intellectual property rights of third parties. The copyright holders -disclaim any liability to any recipient for claims brought against -recipient by any third party for infringement of that parties -intellectual property rights. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -_____ - -The Android Open Source Project - -Copyright (C) 2017 The Android Open Source Project -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - ------- - -libprotobuf-mutator - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ----- - - openucx/ucx - https://github.com/openucx/ucx - - Copyright (c) 2014-2015 UT-Battelle, LLC. All rights reserved. - Copyright (C) 2014-2020 Mellanox Technologies Ltd. All rights reserved. - Copyright (C) 2014-2015 The University of Houston System. All rights reserved. - Copyright (C) 2015 The University of Tennessee and The University - of Tennessee Research Foundation. All rights reserved. - Copyright (C) 2016-2020 ARM Ltd. All rights reserved. - Copyright (c) 2016 Los Alamos National Security, LLC. All rights reserved. - Copyright (C) 2016-2020 Advanced Micro Devices, Inc. All rights reserved. - Copyright (C) 2019 UChicago Argonne, LLC. All rights reserved. - Copyright (c) 2018-2020 NVIDIA CORPORATION. All rights reserved. - Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. - Copyright (C) 2016-2020 Stony Brook University. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ----- - - From PyTorch: - - Copyright (c) 2016- Facebook, Inc (Adam Paszke) - Copyright (c) 2014- Facebook, Inc (Soumith Chintala) - Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert) - Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu) - Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu) - Copyright (c) 2011-2013 NYU (Clement Farabet) - Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston) - Copyright (c) 2006 Idiap Research Institute (Samy Bengio) - Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz) - - From Caffe2: - - Copyright (c) 2016-present, Facebook Inc. All rights reserved. - - All contributions by Facebook: - Copyright (c) 2016 Facebook Inc. - - All contributions by Google: - Copyright (c) 2015 Google Inc. - All rights reserved. - - All contributions by Yangqing Jia: - Copyright (c) 2015 Yangqing Jia - All rights reserved. - - All contributions from Caffe: - Copyright(c) 2013, 2014, 2015, the respective contributors - All rights reserved. - - All other contributions: - Copyright(c) 2015, 2016 the respective contributors - All rights reserved. - - Caffe2 uses a copyright model similar to Caffe: each contributor holds - copyright over their contributions to Caffe2. The project versioning records - all such contribution and copyright details. If a contributor wants to further - mark their specific copyright on a particular contribution, they should - indicate their copyright solely in the commit message of the change when it is - committed. - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. Neither the names of Facebook, Deepmind Technologies, NYU, NEC Laboratories America - and IDIAP Research Institute nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - -_____ - - mpi4py - https://github.com/mpi4py/mpi4py/ - - ======================= - LICENSE: MPI for Python - ======================= - - :Author: Lisandro Dalcin - :Contact: dalcinl@gmail.com - - - Copyright (c) 2019, Lisandro Dalcin. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -_____ -huggingface/transformers - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -_____ -msgpack/msgpack-python - -Copyright (C) 2008-2011 INADA Naoki - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -_____ -lanpa/tensorboardX - -MIT License - -Copyright (c) 2017 Tzu-Wei Huang - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -_____ -tensorflow/tensorboard - -Copyright 2017 The TensorFlow Authors. All rights reserved. - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2017, The TensorFlow Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -_____ - -cerberus - -Cerberus is a lightweight and extensible data validation library for Python. - -ISC License - -Copyright (c) 2012-2016 Nicola Iarocci. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - -_____ - -MurmurHash3 - -MIT license - -https://github.com/aappleby/smhasher - -SMHasher is a test suite designed to test the distribution, collision, and -performance properties of non-cryptographic hash functions. -This is the home for the MurmurHash family of hash functions along with the -SMHasher test suite used to verify them. -SMHasher is released under the MIT license. -All MurmurHash versions are public domain software, and the author disclaims all copyright to their code. - -_____ - -gtest-ios-framework - -https://github.com/mestevens/gtest-ios-framework - -Copyright (c) 2013 Matthew Stevens - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -_____ - -DLPack - -https://github.com/dmlc/dlpack - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2017 by Contributors - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -_____ - -emsdk - -MIT/Expat license - -https://github.com/emscripten-core/emsdk - -Copyright (c) 2018 Emscripten authors (see AUTHORS in Emscripten) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ----------------------------------------------------------------------------- - -This is the MIT/Expat License. For more information see: - -1. http://www.opensource.org/licenses/mit-license.php - -2. http://en.wikipedia.org/wiki/MIT_License - -_____ - -coremltools - -BSD-3-Clause License - -https://github.com/apple/coremltools - -Copyright (c) 2020, Apple Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -© 2021 GitHub, Inc. - -_____ - -react-native - -MIT License - -https://github.com/facebook/react-native - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -_____ - -pytorch/cpuinfo - -BSD 2-Clause "Simplified" License - -https://github.com/pytorch/cpuinfo - -Copyright (c) 2019 Google LLC -Copyright (c) 2017-2018 Facebook Inc. -Copyright (C) 2012-2017 Georgia Institute of Technology -Copyright (C) 2010-2012 Marat Dukhan - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -_____ - -SQLite Is Public Domain - -All of the code and documentation in SQLite has been dedicated to the public -domain by the authors. All code authors, and representatives of the companies -they work for, have signed affidavits dedicating their contributions to the -public domain and originals of those signed affidavits are stored in a firesafe -at the main offices of Hwaci. Anyone is free to copy, modify, publish, use, -compile, sell, or distribute the original SQLite code, either in source code -form or as a compiled binary, for any purpose, commercial or non-commercial, -and by any means. - -The previous paragraph applies to the deliverable code and documentation in -SQLite - those parts of the SQLite library that you actually bundle and ship -with a larger application. Some scripts used as part of the build process (for -example the "configure" scripts generated by autoconf) might fall under other -open-source licenses. Nothing from these build scripts ever reaches the final -deliverable SQLite library, however, and so the licenses associated with those -scripts should not be a factor in assessing your rights to copy and use the -SQLite library. - -All of the deliverable code in SQLite has been written from scratch. No code -has been taken from other projects or from the open internet. Every line of -code can be traced back to its original author, and all of those authors have -public domain dedications on file. So the SQLite code base is clean and is -uncontaminated with licensed code from other projects. - -_____ - -google/XNNPACK - -BSD License - -For XNNPACK software - -Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -Copyright 2019 Google LLC - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name Facebook nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -_____ - -google/sentencepiece, https://github.com/google/sentencepiece -(included when statically linked with onnxruntime-extensions) - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -_____ - -dlfcn-win32/dlfcn-win32 is licensed under the MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -_____ - -The Python Imaging Library (PIL) is - - Copyright © 1997-2011 by Secret Labs AB - Copyright © 1995-2011 by Fredrik Lundh - -Pillow is the friendly PIL fork. It is - - Copyright © 2010-2023 by Alex Clark and contributors - -Like PIL, Pillow is licensed under the open source HPND License: - -By obtaining, using, and/or copying this software and/or its associated -documentation, you agree that you have read, understood, and will comply -with the following terms and conditions: - -Permission to use, copy, modify, and distribute this software and its -associated documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appears in all copies, and that -both that copyright notice and this permission notice appear in supporting -documentation, and that the name of Secret Labs AB or the author not be -used in advertising or publicity pertaining to distribution of the software -without specific, written prior permission. - -SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. -IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL, -INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - -_____ - -openssl/openssl, https://github.com/openssl/openssl - - Apache License - Version 2.0, January 2004 - https://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - -_____ - -Tencent/rapidjson, https://github.com/Tencent/rapidjson - -Tencent is pleased to support the open source community by making RapidJSON available. - -Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. - -If you have downloaded a copy of the RapidJSON binary from Tencent, please note that the RapidJSON binary is licensed under the MIT License. -If you have downloaded a copy of the RapidJSON source code from Tencent, please note that RapidJSON source code is licensed under the MIT License, except for the third-party components listed below which are subject to different license terms. Your integration of RapidJSON into your own projects may require compliance with the MIT License, as well as the other licenses applicable to the third-party components included within RapidJSON. To avoid the problematic JSON license in your own projects, it's sufficient to exclude the bin/jsonchecker/ directory, as it's the only code under the JSON license. -A copy of the MIT License is included in this file. - -Other dependencies and licenses: - -Open Source Software Licensed Under the BSD License: --------------------------------------------------------------------- - -The msinttypes r29 -Copyright (c) 2006-2013 Alexander Chemeris -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -* Neither the name of copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Open Source Software Licensed Under the JSON License: --------------------------------------------------------------------- - -json.org -Copyright (c) 2002 JSON.org -All Rights Reserved. - -JSON_checker -Copyright (c) 2002 JSON.org -All Rights Reserved. - - -Terms of the JSON License: ---------------------------------------------------- - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -The Software shall be used for Good, not Evil. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -Terms of the MIT License: --------------------------------------------------------------------- - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -_____ - -boostorg/boost, https://github.com/boostorg/boost - -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - -_____ - -libb64/libb64, https://github.com/libb64/libb64 - -Copyright-Only Dedication (based on United States law) or Public Domain Certification - -The person or persons who have associated work with this document (the "Dedicator" or "Certifier") hereby either (a) certifies that, to the best of his knowledge, the work of authorship identified is in the public domain of the country from which the work is published, or (b) hereby dedicates whatever copyright the dedicators holds in the work of authorship identified below (the "Work") to the public domain. A certifier, moreover, dedicates any copyright interest he may have in the associated work, and for these purposes, is described as a "dedicator" below. - -A certifier has taken reasonable steps to verify the copyright status of this work. Certifier recognizes that his good faith efforts may not shield him from liability if in fact the work certified is not in the public domain. - -Dedicator makes this dedication for the benefit of the public at large and to the detriment of the Dedicator's heirs and successors. Dedicator intends this dedication to be an overt act of relinquishment in perpetuity of all present and future rights under copyright law, whether vested or contingent, in the Work. Dedicator understands that such relinquishment of all rights includes the relinquishment of all rights to enforce (by lawsuit or otherwise) those copyrights in the Work. - -Dedicator recognizes that, once placed in the public domain, the Work may be freely reproduced, distributed, transmitted, used, modified, built upon, or otherwise exploited by anyone for any purpose, commercial or non-commercial, and in any way, including by methods that have not yet been invented or conceived. - -_____ - -posix pthread library, https://sourceforge.net/projects/pthreads4w - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -_____ - -Triton Inference Server & Client, https://github.com/triton-inference-server - -Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of NVIDIA CORPORATION nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -_____ - -microsoft/mimalloc, https://github.com/microsoft/mimalloc - -MIT License - -Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -_____ - -TensorFlow.js - -https://github.com/tensorflow/tfjs - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -—— - -curl/curl - -https://github.com/curl - -COPYRIGHT AND PERMISSION NOTICE - -Copyright (C) Daniel Stenberg, , and many -contributors, see the THANKS file. - -All rights reserved. - -Permission to use, copy, modify, and distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright -notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN -NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE -OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of a copyright holder shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization of the copyright holder. - -_____ - -Intel neural-compressor - -https://github.com/intel/neural-compressor - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - ============================================================================ - - Copyright 2016-2019 Intel Corporation - Copyright 2018 YANDEX LLC - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - This distribution includes third party software ("third party programs"). - This third party software, even if included with the distribution of - the Intel software, may be governed by separate license terms, including - without limitation, third party license terms, other Intel software license - terms, and open source software license terms. These separate license terms - govern your use of the third party programs as set forth in the - "THIRD-PARTY-PROGRAMS" file. - -_____ - -FlashAttention, https://github.com/Dao-AILab/flash-attention - -BSD 3-Clause License - -Copyright (c) 2022, the respective contributors, as shown by the AUTHORS file. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -_____ - -neural-speed - -https://github.com/intel/neural-speed - - Apache License - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - ============================================================================ - - Copyright 2016-2019 Intel Corporation - Copyright 2018 YANDEX LLC - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - This distribution includes third party software ("third party programs"). - This third party software, even if included with the distribution of - the Intel software, may be governed by separate license terms, including - without limitation, third party license terms, other Intel software license - terms, and open source software license terms. These separate license terms - govern your use of the third party programs as set forth in the - "THIRD-PARTY-PROGRAMS" file. - -_____ - -dawn - -https://dawn.googlesource.com/dawn - - BSD 3-Clause License - - Copyright 2017-2023 The Dawn & Tint Authors - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -_____ - -KleidiAI - -https://gitlab.arm.com/kleidi/kleidiai - -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -Copyright 2024-2025 Arm Limited and/or its affiliates - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/crates/ml/licenses/SAM2-Apache-2.0.txt b/crates/ml/licenses/SAM2-Apache-2.0.txt deleted file mode 100644 index 261eeb9e9f..0000000000 --- a/crates/ml/licenses/SAM2-Apache-2.0.txt +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/crates/ml/src/catalog.rs b/crates/ml/src/catalog.rs deleted file mode 100644 index d9d2287c5f..0000000000 --- a/crates/ml/src/catalog.rs +++ /dev/null @@ -1,145 +0,0 @@ -//! Reviewed FP32 exports. URLs contain immutable revisions; sizes and SHA-256s come from their -//! Hugging Face LFS metadata. Updating a model is a code review, never a remote manifest update. -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub enum ModelId { - #[serde(rename = "birefnet-hr-matting")] - BiRefNet, - #[serde(rename = "sam2.1-large")] - Sam2, -} - -impl ModelId { - pub fn parse(id: &str) -> Option { - match id { - "birefnet-hr-matting" => Some(Self::BiRefNet), - "sam2.1-large" => Some(Self::Sam2), - _ => None, - } - } - pub fn name(self) -> &'static str { - match self { - Self::BiRefNet => "birefnet-hr-matting", - Self::Sam2 => "sam2.1-large", - } - } - pub fn index(self) -> usize { - match self { - Self::BiRefNet => 0, - Self::Sam2 => 1, - } - } - pub fn info(self) -> &'static ModelInfo { - match self { - Self::BiRefNet => &MODELS[0], - Self::Sam2 => &MODELS[1], - } - } -} - -#[derive(Clone, Copy, Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Artifact { - pub file: &'static str, - pub url: &'static str, - pub bytes: u64, - pub sha256: &'static str, -} - -#[derive(Clone, Copy, Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ModelInfo { - pub id: ModelId, - pub label: &'static str, - pub purpose: &'static str, - pub input_side: usize, - pub revision: &'static str, - pub license: &'static str, - pub upstream: &'static str, - pub export_source: &'static str, - pub artifacts: &'static [Artifact], -} - -impl ModelInfo { - pub fn download_bytes(&self) -> u64 { - self.artifacts.iter().map(|a| a.bytes).sum() - } -} - -pub const MODELS: [ModelInfo; 2] = [ - ModelInfo { - id: ModelId::BiRefNet, - label: "BiRefNet HR Matting", - purpose: "Select Subject and Remove Background; detailed, soft edges", - input_side: 2048, - revision: "792518b9d4dfe9793891712677de25e554f948c6", - license: "MIT", - upstream: "https://huggingface.co/ZhengPeng7/BiRefNet_HR-matting", - export_source: "https://huggingface.co/PinkPixel/birefnet-hr-matting-onnx", - artifacts: &[Artifact { - file: "model.onnx", - url: "https://huggingface.co/PinkPixel/birefnet-hr-matting-onnx/resolve/792518b9d4dfe9793891712677de25e554f948c6/model.onnx", - bytes: 932_150_975, - sha256: "a548a1f3307250766bef50b174026b3cfa39a695bc1e42ec131c14fe82797ffd", - }], - }, - ModelInfo { - id: ModelId::Sam2, - label: "SAM 2.1 Large", - purpose: "Object Selection; drag a box around the object", - input_side: 1024, - revision: "3c23431f721e69cae82dbfd0c28fd692cc714021", - license: "Apache-2.0", - upstream: "https://huggingface.co/facebook/sam2.1-hiera-large", - export_source: "https://huggingface.co/onnx-community/sam2.1-hiera-large-ONNX", - artifacts: &[ - Artifact { - file: "vision_encoder.onnx", - url: "https://huggingface.co/onnx-community/sam2.1-hiera-large-ONNX/resolve/3c23431f721e69cae82dbfd0c28fd692cc714021/onnx/vision_encoder.onnx", - bytes: 1_350_487, - sha256: "ad3a8161c6bd6d8beea811300c60e20d626035feaa3c19622ace27b22e25bec8", - }, - Artifact { - file: "vision_encoder.onnx_data", - url: "https://huggingface.co/onnx-community/sam2.1-hiera-large-ONNX/resolve/3c23431f721e69cae82dbfd0c28fd692cc714021/onnx/vision_encoder.onnx_data", - bytes: 888_587_456, - sha256: "88c501a65b6aaeac99b65a275f3f559727404283930d107d499fda8714ba7e5a", - }, - Artifact { - file: "prompt_encoder_mask_decoder.onnx", - url: "https://huggingface.co/onnx-community/sam2.1-hiera-large-ONNX/resolve/3c23431f721e69cae82dbfd0c28fd692cc714021/onnx/prompt_encoder_mask_decoder.onnx", - bytes: 213_114, - sha256: "a21b3b09f6e5f5838d630d92a150914ca58f8f58b603b8f53fc32b03da982203", - }, - Artifact { - file: "prompt_encoder_mask_decoder.onnx_data", - url: "https://huggingface.co/onnx-community/sam2.1-hiera-large-ONNX/resolve/3c23431f721e69cae82dbfd0c28fd692cc714021/onnx/prompt_encoder_mask_decoder.onnx_data", - bytes: 20_958_208, - sha256: "bfdcd4f7ee04298a82fe1aaf1bd7b8edf544d36901e1a886f01892fb915bd63c", - }, - ], - }, -]; - -#[cfg(test)] -mod tests { - use super::*; - #[test] - fn catalog_is_pinned_and_ids_cannot_escape_storage() { - for m in MODELS { - assert_eq!(ModelId::parse(m.id.name()), Some(m.id)); - for a in m.artifacts { - assert!(a.url.starts_with("https://huggingface.co/")); - assert!(a.url.contains(m.revision)); - assert!(a.bytes > 0 && a.bytes < 2_000_000_000); - assert_eq!(a.sha256.len(), 64); - assert!(a.sha256.bytes().all(|c| c.is_ascii_hexdigit())); - assert!(!a.file.contains(['/', '\\'])); - } - } - for id in ["../model", "sam3", "", "https://example.com/model.onnx"] { - assert_eq!(ModelId::parse(id), None); - } - } -} diff --git a/crates/ml/src/image.rs b/crates/ml/src/image.rs deleted file mode 100644 index 2381674e27..0000000000 --- a/crates/ml/src/image.rs +++ /dev/null @@ -1,127 +0,0 @@ -use photocraft_algo::segment::RgbImage; -use photocraft_raster::Interrupt; - -use crate::{Error, Result, check}; - -const MAX_PIXELS: usize = 2048 * 2048; - -#[derive(Clone, Copy, Debug, PartialEq)] -pub enum MaskKind { - /// A matting model's continuous opacity, interpolated without thresholding. - Alpha, - /// SAM logits: interpolate at destination resolution, then threshold at zero. - Logits, -} - -#[derive(Clone, Debug)] -pub struct AlphaMask { - pub width: usize, - pub height: usize, - pub values: Vec, - pub kind: MaskKind, -} - -impl AlphaMask { - pub fn validate(&self) -> Result<()> { - let n = self.width.checked_mul(self.height).filter(|n| *n > 0 && *n <= MAX_PIXELS); - if n != Some(self.values.len()) || self.values.iter().any(|v| !v.is_finite()) { - return Err(Error::Inference("invalid mask dimensions or non-finite values".into())); - } - Ok(()) - } - - /// Bilinear, half-pixel centres, with border clamping. Coordinates are normalized to the - /// source image, so non-square documents and prompts use the same mapping. - pub fn sample(&self, x: f32, y: f32) -> f32 { - bilinear(self.width, self.height, x, y, |i| self.values.get(i).copied().unwrap_or(0.0)) - } - - pub fn coverage(&self, x: f32, y: f32) -> u8 { - let v = self.sample(x, y); - match self.kind { - MaskKind::Alpha => (v.clamp(0.0, 1.0) * 255.0).round() as u8, - MaskKind::Logits => { - if v > 0.0 { - 255 - } else { - 0 - } - } - } - } -} - -fn bilinear(w: usize, h: usize, x: f32, y: f32, at: impl Fn(usize) -> f32) -> f32 { - if w.checked_mul(h).is_none_or(|n| n == 0 || n > MAX_PIXELS) || !x.is_finite() || !y.is_finite() { - return 0.0; - } - let x = (x * w as f32 - 0.5).clamp(0.0, (w - 1) as f32); - let y = (y * h as f32 - 0.5).clamp(0.0, (h - 1) as f32); - let (x0, y0) = (x.floor() as usize, y.floor() as usize); - let (x1, y1) = ((x0 + 1).min(w - 1), (y0 + 1).min(h - 1)); - let (fx, fy) = (x - x0 as f32, y - y0 as f32); - let a = at(y0 * w + x0) * (1.0 - fx) + at(y0 * w + x1) * fx; - let b = at(y1 * w + x0) * (1.0 - fx) + at(y1 * w + x1) * fx; - a * (1.0 - fy) + b * fy -} - -/// Model RGB is sRGB in 0..=1, resized to its training square and ImageNet-normalized NCHW. -/// The engine is responsible for converting the document profile before reaching this seam. -pub fn normalize(image: &RgbImage, side: usize, ctl: &Interrupt<'_>) -> Result> { - let n = image.w.checked_mul(image.h).filter(|n| *n > 0 && *n <= MAX_PIXELS); - let plane = side.checked_mul(side).filter(|n| *n > 0 && *n <= MAX_PIXELS); - if n != Some(image.px.len()) || plane.is_none() || image.px.iter().flatten().any(|v| !v.is_finite()) { - return Err(Error::Input("invalid image dimensions or values".into())); - } - let plane = plane.ok_or_else(|| Error::Input("invalid input size".into()))?; - let mut out = vec![0.0; plane * 3]; - let mean = [0.485, 0.456, 0.406]; - let std = [0.229, 0.224, 0.225]; - for (c, channel) in out.chunks_exact_mut(plane).enumerate() { - for (y, row) in channel.chunks_exact_mut(side).enumerate() { - check(ctl)?; - for (x, dst) in row.iter_mut().enumerate() { - let v = bilinear(image.w, image.h, (x as f32 + 0.5) / side as f32, (y as f32 + 0.5) / side as f32, |i| { - image.px.get(i).and_then(|p| p.get(c)).copied().unwrap_or(0.0) - }); - *dst = (v.clamp(0.0, 1.0) - mean.get(c).copied().unwrap_or(0.0)) / std.get(c).copied().unwrap_or(1.0); - } - } - } - Ok(out) -} - -#[cfg(test)] -mod tests { - use super::*; - #[test] - fn normalized_rgb_uses_channels_first_and_keeps_aspect_mapping() { - let im = RgbImage { w: 2, h: 1, px: vec![[1.0, 0.0, 0.5], [0.0, 1.0, 0.5]] }; - let v = normalize(&im, 2, &Interrupt::NONE).unwrap(); - assert_eq!(v.len(), 12); - assert!((v[0] - (1.0 - 0.485) / 0.229).abs() < 1e-6); - assert!((v[5] - (1.0 - 0.456) / 0.224).abs() < 1e-6); - assert_eq!(v[0], v[2]); - assert_eq!(v[8], v[11]); - } - #[test] - fn matting_preserves_fractional_coverage_and_sam_thresholds_after_resize() { - let mut m = AlphaMask { width: 2, height: 1, values: vec![0.0, 1.0], kind: MaskKind::Alpha }; - assert_eq!(m.coverage(0.5, 0.5), 128); - assert_eq!(m.coverage(0.0, 0.5), 0); - assert_eq!(m.coverage(1.0, 0.5), 255); - m.kind = MaskKind::Logits; - m.values = vec![-2.0, 2.0]; - assert_eq!(m.coverage(0.75, 0.5), 255); - assert_eq!(m.coverage(0.25, 0.5), 0); - } - #[test] - fn malformed_tensors_and_cancellation_fail_gracefully() { - let im = RgbImage { w: usize::MAX, h: 2, px: vec![] }; - assert!(normalize(&im, 2048, &Interrupt::NONE).is_err()); - let m = AlphaMask { width: 1, height: 1, values: vec![f32::NAN], kind: MaskKind::Alpha }; - assert!(m.validate().is_err()); - let im = RgbImage { w: 1, h: 1, px: vec![[0.0; 3]] }; - assert!(matches!(normalize(&im, 2, &Interrupt::cancel_only(&|| true)), Err(Error::Cancelled))); - } -} diff --git a/crates/ml/src/lib.rs b/crates/ml/src/lib.rs deleted file mode 100644 index 2d633be5b5..0000000000 --- a/crates/ml/src/lib.rs +++ /dev/null @@ -1,68 +0,0 @@ -//! Optional, local image segmentation. The default build contains only the model catalogue and -//! the backend seam; `onnx` adds native CPU inference and explicit, verified downloads. -#![forbid(unsafe_code)] -#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] - -pub mod catalog; -mod image; -pub use catalog::{MODELS, ModelId, ModelInfo}; -pub use image::{AlphaMask, MaskKind, normalize}; - -#[cfg(all(feature = "onnx", not(target_arch = "wasm32")))] -mod native; -#[cfg(all(feature = "onnx", not(target_arch = "wasm32")))] -pub use native::NativeBackend; - -#[cfg(all(test, feature = "onnx", not(target_arch = "wasm32")))] -mod test_models; - -use photocraft_algo::segment::RgbImage; -use photocraft_raster::Interrupt; -use serde::Serialize; - -#[derive(Debug, thiserror::Error)] -pub enum Error { - #[error("cancelled")] - Cancelled, - #[error("invalid model input: {0}")] - Input(String), - #[error("local model unavailable: {0}")] - Unavailable(String), - #[error("model download: {0}")] - Download(String), - #[error("model inference: {0}")] - Inference(String), - #[error("model storage: {0}")] - Io(#[from] std::io::Error), -} - -pub type Result = std::result::Result; - -pub(crate) fn check(ctl: &Interrupt<'_>) -> Result<()> { - ctl.check().map_err(|_| Error::Cancelled) -} - -/// Coordinates relative to the full input image, in 0..=1. A box guides SAM to one object; -/// automatic foreground matting uses `Subject`. -#[derive(Clone, Copy, Debug, PartialEq)] -pub enum Prompt { - Subject, - Box([f32; 4]), -} - -#[derive(Clone, Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct ModelStatus { - pub id: ModelId, - pub installed: bool, - pub busy: bool, -} - -/// No document or UI types cross this seam. Tests can inject a deterministic backend; the web -/// and builds without `onnx` keep the existing classical algorithms and never access the network. -pub trait InferenceBackend: Send + Sync { - fn status(&self) -> Vec; - fn download(&self, id: ModelId, ctl: &Interrupt<'_>) -> Result<()>; - fn remove(&self, id: ModelId, ctl: &Interrupt<'_>) -> Result<()>; - fn infer(&self, id: ModelId, image: &RgbImage, prompt: Prompt, ctl: &Interrupt<'_>) -> Result; -} diff --git a/crates/ml/src/native.rs b/crates/ml/src/native.rs deleted file mode 100644 index 25f61d195d..0000000000 --- a/crates/ml/src/native.rs +++ /dev/null @@ -1,542 +0,0 @@ -//! Native CPU backend. Model installation is explicit; inference never downloads anything. -use std::fs::{self, File}; -use std::io::{Read, Write}; -use std::path::{Path, PathBuf}; -use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::{Arc, Mutex, MutexGuard, PoisonError}; -use std::time::Duration; - -use ort::session::{RunOptions, Session as OnnxSession, builder::GraphOptimizationLevel}; -use ort::value::Tensor; -use photocraft_algo::segment::RgbImage; -use photocraft_raster::Interrupt; -use sha2::{Digest, Sha256}; -use ureq::unversioned::transport::{Buffers, ConnectionDetails, Connector, DefaultConnector, NextTimeout, Transport}; - -use crate::catalog::Artifact; -use crate::{AlphaMask, Error, InferenceBackend, MaskKind, ModelId, ModelStatus, Prompt, Result, check, normalize}; - -impl From> for Error { - fn from(e: ort::Error) -> Self { - Self::Inference(e.to_string()) - } -} - -/// Platform frontends choose the directory. Constructing a backend does not create it, contact -/// a server, load ONNX Runtime or load any model. At most one model stays resident at a time. -pub struct NativeBackend { - root: PathBuf, - operations: [Mutex<()>; 2], - sessions: Mutex>, -} - -enum Sessions { - BiRefNet(OnnxSession), - Sam2 { encoder: OnnxSession, decoder: OnnxSession }, -} - -struct Loaded { - id: ModelId, - sessions: Sessions, -} - -/// ureq's body timeout covers the whole download, rather than each read. Keep large downloads -/// possible while bounding stalled reads (and cancellation cleanup) to 30 seconds. Delegate TLS, -/// redirects and proxy handling to its default connector; never weaken certificate validation. -#[derive(Debug)] -struct IdleConnector; -#[derive(Debug)] -struct IdleTransport(Box); -impl Connector for IdleConnector { - type Out = IdleTransport; - fn connect(&self, details: &ConnectionDetails<'_>, chained: Option<()>) -> std::result::Result, ureq::Error> { - Ok(DefaultConnector::default().connect(details, chained)?.map(IdleTransport)) - } -} -fn idle_timeout(timeout: NextTimeout) -> NextTimeout { - let after = ureq::unversioned::transport::time::Duration::from_secs(30); - if *timeout.after > *after { NextTimeout { after, reason: ureq::Timeout::RecvBody } } else { timeout } -} -impl Transport for IdleTransport { - fn buffers(&mut self) -> &mut dyn Buffers { - self.0.buffers() - } - fn transmit_output(&mut self, amount: usize, timeout: NextTimeout) -> std::result::Result<(), ureq::Error> { - self.0.transmit_output(amount, timeout) - } - fn await_input(&mut self, timeout: NextTimeout) -> std::result::Result { - self.0.await_input(idle_timeout(timeout)) - } - fn is_open(&mut self) -> bool { - self.0.is_open() - } - fn is_tls(&self) -> bool { - self.0.is_tls() - } -} - -impl NativeBackend { - pub fn new(root: PathBuf) -> Self { - Self { root, operations: Default::default(), sessions: Mutex::new(None) } - } - - fn directory(&self, id: ModelId) -> PathBuf { - self.root.join(format!("{}-{}", id.name(), id.info().revision)) - } - - fn operation(&self, id: ModelId) -> Result> { - let lock = self.operations.get(id.index()).ok_or_else(|| Error::Input("unknown model".into()))?; - match lock.try_lock() { - Ok(guard) => Ok(guard), - Err(std::sync::TryLockError::Poisoned(e)) => { - lock.clear_poison(); - Ok(e.into_inner()) - } - Err(std::sync::TryLockError::WouldBlock) => { - Err(Error::Unavailable(format!("{} is in use or downloading; try again when it finishes", id.info().label))) - } - } - } - - fn installed(&self, id: ModelId) -> bool { - let dir = self.directory(id); - fs::symlink_metadata(&dir).is_ok_and(|m| m.is_dir()) - && id.info().artifacts.iter().all(|a| fs::symlink_metadata(dir.join(a.file)).is_ok_and(|m| m.is_file() && m.len() == a.bytes)) - } - - fn verify(&self, id: ModelId, ctl: &Interrupt<'_>) -> Result<()> { - if !self.installed(id) { - return Err(Error::Unavailable(format!("download {} in Preferences › Integrations first", id.info().label))); - } - for a in id.info().artifacts { - check(ctl)?; - // Hash before parsing, including external weights. No ONNX from a mutable URL or an - // unverified local file is executed, and external data paths are pinned with it. - copy_verified(&mut File::open(self.directory(id).join(a.file))?, &mut std::io::sink(), a, ctl, |_| {})?; - } - Ok(()) - } -} - -impl InferenceBackend for NativeBackend { - fn status(&self) -> Vec { - crate::MODELS - .iter() - .map(|m| ModelStatus { - id: m.id, - installed: self.installed(m.id), - busy: self.operations.get(m.id.index()).is_some_and(|l| matches!(l.try_lock(), Err(std::sync::TryLockError::WouldBlock))), - }) - .collect() - } - - fn download(&self, id: ModelId, ctl: &Interrupt<'_>) -> Result<()> { - let _guard = self.operation(id)?; - check(ctl)?; - if self.installed(id) { - self.verify(id, ctl)?; - ctl.progress(1.0); - return Ok(()); - } - let dest = self.directory(id); - if dest.try_exists()? { - return Err(Error::Download("incomplete or corrupt installation; remove this model in Preferences and download it again".into())); - } - fs::create_dir_all(&self.root)?; - // Every error, timeout or cancellation drops the staging directory. Windows rename is - // atomic too because the destination does not exist; installed files are never overwritten. - let staging = tempfile::Builder::new().prefix("photocraft-model-").tempdir_in(&self.root)?; - let config = ureq::Agent::config_builder() - .https_only(true) - .max_redirects(5) - .timeout_resolve(Some(Duration::from_secs(15))) - .timeout_connect(Some(Duration::from_secs(15))) - .timeout_recv_response(Some(Duration::from_secs(30))) - .timeout_recv_body(Some(Duration::from_secs(3600))) - .build(); - let agent = ureq::Agent::with_parts(config, IdleConnector, ureq::unversioned::resolver::DefaultResolver::default()); - let total = id.info().download_bytes() as f32; - let mut completed = 0u64; - for a in id.info().artifacts { - check(ctl)?; - let mut response = agent - .get(a.url) - .header("User-Agent", "PhotoCraft-model-download") - .call() - .map_err(|e| Error::Download(format!("{}: {e}; try again", a.file)))?; - let mut file = File::create(staging.path().join(a.file))?; - copy_verified(&mut response.body_mut().as_reader(), &mut file, a, ctl, |bytes| ctl.progress((completed + bytes) as f32 / total * 0.98)).map_err( - |e| match e { - Error::Cancelled => e, - e => Error::Download(format!("{}: {e}; partial download discarded; try again", a.file)), - }, - )?; - file.flush()?; - file.sync_all()?; - completed += a.bytes; - } - let license = match id { - ModelId::BiRefNet => include_str!("../licenses/BiRefNet-MIT.txt"), - ModelId::Sam2 => include_str!("../licenses/SAM2-Apache-2.0.txt"), - }; - fs::write(staging.path().join("LICENSE.txt"), license)?; - fs::write( - staging.path().join("SOURCE.txt"), - format!("{}\nUpstream: {}\nONNX export: {}\nRevision: {}\n", id.info().label, id.info().upstream, id.info().export_source, id.info().revision), - )?; - check(ctl)?; - fs::rename(staging.path(), dest)?; - ctl.progress(1.0); - Ok(()) - } - - fn remove(&self, id: ModelId, ctl: &Interrupt<'_>) -> Result<()> { - let _guard = self.operation(id)?; - check(ctl)?; - let mut loaded = self.sessions.lock().unwrap_or_else(PoisonError::into_inner); - check(ctl)?; - if loaded.as_ref().is_some_and(|l| l.id == id) { - // Close external weight files before removing on Windows. - *loaded = None; - } - let path = self.directory(id); - if path.try_exists()? { - if !fs::symlink_metadata(&path)?.is_dir() { - return Err(Error::Unavailable("model installation is not a regular directory".into())); - } - fs::remove_dir_all(path)?; - } - ctl.progress(1.0); - Ok(()) - } - - fn infer(&self, id: ModelId, image: &RgbImage, prompt: Prompt, ctl: &Interrupt<'_>) -> Result { - let _guard = self.operation(id)?; - validate_prompt(id, prompt)?; - let input = normalize(image, id.info().input_side, ctl)?; - self.verify(id, ctl)?; - let mut loaded = match self.sessions.try_lock() { - Ok(guard) => guard, - Err(std::sync::TryLockError::Poisoned(e)) => { - let mut guard = e.into_inner(); - *guard = None; - self.sessions.clear_poison(); - guard - } - Err(std::sync::TryLockError::WouldBlock) => return Err(Error::Unavailable("another local model is running; try again when it finishes".into())), - }; - if loaded.as_ref().is_none_or(|l| l.id != id) { - *loaded = None; - check(ctl)?; - let dir = self.directory(id); - let sessions = match id { - ModelId::BiRefNet => Sessions::BiRefNet(session(&dir.join("model.onnx"))?), - ModelId::Sam2 => { - Sessions::Sam2 { encoder: session(&dir.join("vision_encoder.onnx"))?, decoder: session(&dir.join("prompt_encoder_mask_decoder.onnx"))? } - } - }; - *loaded = Some(Loaded { id, sessions }); - } - check(ctl)?; - ctl.progress(0.2); - let current = loaded.as_mut().ok_or_else(|| Error::Inference("model did not load".into()))?; - let result = match &mut current.sessions { - Sessions::BiRefNet(model) => birefnet(model, input, ctl), - Sessions::Sam2 { encoder, decoder } => sam2(encoder, decoder, input, prompt, ctl), - }?; - result.validate()?; - check(ctl)?; - ctl.progress(1.0); - Ok(result) - } -} - -fn validate_prompt(id: ModelId, p: Prompt) -> Result<()> { - match (id, p) { - (ModelId::BiRefNet, Prompt::Subject) => Ok(()), - (ModelId::Sam2, Prompt::Box([x0, y0, x1, y1])) if [x0, y0, x1, y1].iter().all(|v| v.is_finite() && (0.0..=1.0).contains(v)) && x0 < x1 && y0 < y1 => { - Ok(()) - } - _ => Err(Error::Input("this model does not support the requested prompt".into())), - } -} - -fn session(path: &Path) -> Result { - let threads = std::thread::available_parallelism().map_or(2, |v| v.get()).clamp(1, 8); - // Keeping weights resident is useful, but retaining peak 2048px intermediates in an arena - // (then allocating a contiguous memory-pattern block on the second run) can exhaust RAM. - // Prefer releasing temporary buffers over latency: these models are explicitly optional. - Ok(OnnxSession::builder()? - .with_execution_providers([ort::ep::CPU::default().with_arena_allocator(false).build()])? - .with_memory_pattern(false)? - .with_intra_threads(threads)? - .with_optimization_level(GraphOptimizationLevel::Level3)? - .commit_from_file(path)?) -} - -/// ORT supports terminating a run from another thread. The watcher exits at completion or -/// cancellation; it owns no document and never outlives the job. No fictitious per-node progress. -fn cancellable(ctl: &Interrupt<'_>, f: impl FnOnce(&RunOptions) -> Result) -> Result { - check(ctl)?; - let options = Arc::new(RunOptions::new()?); - let done = AtomicBool::new(false); - std::thread::scope(|scope| { - let monitor = std::thread::Builder::new().name("photocraft-model-cancel".into()).spawn_scoped(scope, || { - while !done.load(Ordering::Relaxed) { - if ctl.cancelled() { - let _ = options.terminate(); - break; - } - std::thread::sleep(Duration::from_millis(25)); - } - })?; - // Release the scoped watcher even if a dependency unexpectedly unwinds: the engine's - // last-resort panic guard must be able to report it instead of hanging while joining. - struct Complete<'a>(&'a AtomicBool); - impl Drop for Complete<'_> { - fn drop(&mut self) { - self.0.store(true, Ordering::Relaxed); - } - } - let complete = Complete(&done); - let result = f(&options); - drop(complete); - monitor.join().map_err(|_| Error::Inference("cancellation watcher failed".into()))?; - check(ctl)?; - result - }) -} - -fn birefnet(model: &mut OnnxSession, input: Vec, ctl: &Interrupt<'_>) -> Result { - let tensor = Tensor::from_array(([1usize, 3, 2048, 2048], input.into_boxed_slice()))?; - cancellable(ctl, |options| { - let outputs = model.run_with_options(ort::inputs!["image" => tensor], options)?; - let output = outputs.get("alpha").ok_or_else(|| Error::Inference("BiRefNet export has no alpha output".into()))?; - let (shape, values) = output.try_extract_tensor::()?; - if shape.as_ref() != [1, 1, 2048, 2048] { - return Err(Error::Inference("unexpected BiRefNet output shape".into())); - } - // This reviewed export already includes sigmoid: applying it twice turns backgrounds gray. - Ok(AlphaMask { width: 2048, height: 2048, values: values.to_vec(), kind: MaskKind::Alpha }) - }) -} - -fn sam2(encoder: &mut OnnxSession, decoder: &mut OnnxSession, input: Vec, prompt: Prompt, ctl: &Interrupt<'_>) -> Result { - let Prompt::Box(bbox) = prompt else { return Err(Error::Input("SAM needs a box".into())) }; - let image = Tensor::from_array(([1usize, 3, 1024, 1024], input.into_boxed_slice()))?; - let (e0, e1, e2) = cancellable(ctl, |options| { - let outputs = encoder.run_with_options(ort::inputs!["pixel_values" => image], options)?; - let embedding = |name| -> Result> { - let v = outputs.get(name).ok_or_else(|| Error::Inference(format!("SAM export has no {name} output")))?; - let (shape, values) = v.try_extract_tensor::()?; - Ok(Tensor::from_array((shape.to_vec(), values.to_vec().into_boxed_slice()))?) - }; - Ok((embedding("image_embeddings.0")?, embedding("image_embeddings.1")?, embedding("image_embeddings.2")?)) - })?; - ctl.progress(0.85); - // A padding point is ignored by SAM; the box supplies corner labels 2 and 3 inside the - // decoder. The reviewed export uses int64 labels and coordinates on its 1024-pixel square. - let points = Tensor::from_array(([1usize, 1, 1, 2], vec![0.0f32; 2].into_boxed_slice()))?; - let labels = Tensor::from_array(([1usize, 1, 1], vec![-1i64].into_boxed_slice()))?; - let boxes = Tensor::from_array(([1usize, 1, 4], bbox.map(|v| v * 1024.0).to_vec().into_boxed_slice()))?; - cancellable(ctl, |options| { - let outputs = decoder.run_with_options( - ort::inputs![ - "input_points" => points, - "input_labels" => labels, - "input_boxes" => boxes, - "image_embeddings.0" => e0, - "image_embeddings.1" => e1, - "image_embeddings.2" => e2, - ], - options, - )?; - let masks = outputs.get("pred_masks").ok_or_else(|| Error::Inference("SAM has no mask output".into()))?; - let scores = outputs.get("iou_scores").ok_or_else(|| Error::Inference("SAM has no score output".into()))?; - let (shape, values) = masks.try_extract_tensor::()?; - let (_, scores) = scores.try_extract_tensor::()?; - sam_mask(shape.as_ref(), values, scores) - }) -} - -fn sam_mask(shape: &[i64], values: &[f32], scores: &[f32]) -> Result { - let [1, 1, count, height, width] = shape else { return Err(Error::Inference("unexpected SAM output shape".into())) }; - if ![count, height, width].iter().all(|v| **v > 0) - || *count > 3 - || *height > 2048 - || *width > 2048 - || scores.len() != *count as usize - || scores.iter().any(|v| !v.is_finite()) - { - return Err(Error::Inference("invalid SAM mask dimensions or scores".into())); - } - let plane = (*width as usize).checked_mul(*height as usize).ok_or_else(|| Error::Inference("mask too large".into()))?; - if values.len() != plane * *count as usize { - return Err(Error::Inference("SAM mask length mismatch".into())); - } - let best = scores.iter().enumerate().max_by(|(_, a), (_, b)| a.total_cmp(b)).map_or(0, |(i, _)| i); - let chosen = values.get(best * plane..(best + 1) * plane).ok_or_else(|| Error::Inference("SAM mask missing".into()))?; - Ok(AlphaMask { width: *width as usize, height: *height as usize, values: chosen.to_vec(), kind: MaskKind::Logits }) -} - -fn copy_verified(reader: &mut dyn Read, writer: &mut dyn Write, artifact: &Artifact, ctl: &Interrupt<'_>, progress: impl Fn(u64)) -> Result<()> { - let mut hasher = Sha256::new(); - let mut buffer = [0u8; 64 * 1024]; - let mut count = 0u64; - loop { - check(ctl)?; - let read = reader.read(&mut buffer)?; - if read == 0 { - break; - } - count = count.checked_add(read as u64).ok_or_else(|| Error::Download("download too large".into()))?; - if count > artifact.bytes { - return Err(Error::Download(format!("{} exceeds its pinned size", artifact.file))); - } - let chunk = buffer.get(..read).ok_or_else(|| Error::Download("invalid read length".into()))?; - writer.write_all(chunk)?; - hasher.update(chunk); - progress(count); - } - check(ctl)?; - if count != artifact.bytes || format!("{:x}", hasher.finalize()) != artifact.sha256 { - return Err(Error::Download(format!("{} failed size/SHA-256 verification; no model was installed", artifact.file))); - } - Ok(()) -} - -#[cfg(test)] -mod tests { - use super::*; - - const ABC: Artifact = Artifact { - file: "test.onnx", - url: "https://example.invalid/test.onnx", - bytes: 3, - sha256: "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", - }; - - #[test] - fn stalled_reads_are_bounded_without_shortening_a_stricter_deadline() { - use ureq::unversioned::transport::time::Duration; - let t = NextTimeout { after: Duration::NotHappening, reason: ureq::Timeout::RecvBody }; - assert_eq!(idle_timeout(t).after, Duration::from_secs(30)); - let t = NextTimeout { after: Duration::from_secs(3), reason: ureq::Timeout::Global }; - assert_eq!(idle_timeout(t), t); - } - - #[test] - fn cancellation_watcher_exits_when_a_dependency_unwinds() { - let started = std::time::Instant::now(); - let r = std::panic::catch_unwind(|| cancellable::<()>(&Interrupt::NONE, |_| panic!("synthetic dependency panic"))); - assert!(r.is_err()); - assert!(started.elapsed() < Duration::from_secs(1)); - } - - #[test] - fn a_dependency_panic_does_not_leave_the_model_permanently_busy() { - let temp = tempfile::tempdir().unwrap(); - let backend = NativeBackend::new(temp.path().into()); - let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { - let _guard = backend.operation(ModelId::Sam2).unwrap(); - panic!("synthetic dependency panic"); - })); - assert!(backend.status().iter().all(|s| !s.busy)); - assert!(backend.operation(ModelId::Sam2).is_ok()); - } - - #[test] - fn cpu_runtime_executes_both_export_contracts_without_downloads() { - let dir = tempfile::tempdir().unwrap(); - for (name, bytes) in - [("matte.onnx", crate::test_models::MATTE), ("encoder.onnx", crate::test_models::ENCODER), ("decoder.onnx", crate::test_models::DECODER)] - { - fs::write(dir.path().join(name), bytes).unwrap(); - } - let mut matte = session(&dir.path().join("matte.onnx")).unwrap(); - let alpha = birefnet(&mut matte, vec![0.0; 3 * 2048 * 2048], &Interrupt::NONE).unwrap(); - assert_eq!(alpha.kind, MaskKind::Alpha); - assert!(alpha.values.iter().all(|v| (*v - 0.5).abs() < 1e-6)); - let mut encoder = session(&dir.path().join("encoder.onnx")).unwrap(); - let mut decoder = session(&dir.path().join("decoder.onnx")).unwrap(); - let mask = sam2(&mut encoder, &mut decoder, vec![0.0; 3 * 1024 * 1024], Prompt::Box([0.1, 0.2, 0.9, 0.8]), &Interrupt::NONE).unwrap(); - assert_eq!(mask.kind, MaskKind::Logits); - assert_eq!(mask.values, vec![1.0, 2.0]); - assert!(matches!(birefnet(&mut matte, vec![0.0; 3 * 2048 * 2048], &Interrupt::cancel_only(&|| true)), Err(Error::Cancelled))); - } - - #[test] - fn verified_stream_rejects_truncation_corruption_overflow_and_cancel() { - let mut out = Vec::new(); - copy_verified(&mut &b"abc"[..], &mut out, &ABC, &Interrupt::NONE, |_| {}).unwrap(); - assert_eq!(out, b"abc"); - for input in [b"ab".as_slice(), b"abd".as_slice(), b"abcd".as_slice()] { - assert!(copy_verified(&mut &input[..], &mut Vec::new(), &ABC, &Interrupt::NONE, |_| {}).is_err()); - } - assert!(matches!(copy_verified(&mut &b"abc"[..], &mut Vec::new(), &ABC, &Interrupt::cancel_only(&|| true), |_| {}), Err(Error::Cancelled))); - } - - #[test] - fn constructing_and_querying_a_backend_does_not_create_a_directory_or_download() { - let temp = tempfile::tempdir().unwrap(); - let root = temp.path().join("models"); - let b = NativeBackend::new(root.clone()); - assert!(b.status().iter().all(|m| !m.installed)); - assert!(!root.exists()); - assert!(b.infer(ModelId::BiRefNet, &RgbImage::new(1, 1), Prompt::Subject, &Interrupt::NONE).is_err()); - assert!(!root.exists()); - } - - #[test] - fn remove_is_scoped_to_the_selected_model_and_busy_models_are_protected() { - let temp = tempfile::tempdir().unwrap(); - let b = NativeBackend::new(temp.path().into()); - let dir = b.directory(ModelId::BiRefNet); - fs::create_dir_all(&dir).unwrap(); - fs::write(dir.join("partial"), b"bad").unwrap(); - let unrelated = temp.path().join("preferences.json"); - fs::write(&unrelated, b"keep").unwrap(); - let guard = b.operation(ModelId::BiRefNet).unwrap(); - assert!(b.remove(ModelId::BiRefNet, &Interrupt::NONE).is_err()); - drop(guard); - b.remove(ModelId::BiRefNet, &Interrupt::NONE).unwrap(); - assert!(!dir.exists()); - assert_eq!(fs::read(unrelated).unwrap(), b"keep"); - } - - #[test] - fn sam_selects_the_highest_scoring_mask_and_rejects_bad_shapes() { - let m = sam_mask(&[1, 1, 3, 1, 2], &[-1.0, -1.0, 1.0, 2.0, 9.0, 9.0], &[0.2, 0.9, 0.4]).unwrap(); - assert_eq!(m.values, vec![1.0, 2.0]); - assert!(sam_mask(&[1, 1, i64::MAX, 1, 2], &[], &[]).is_err()); - assert!(sam_mask(&[1, 1, 1, 1, 2], &[0.0], &[1.0]).is_err()); - assert!(validate_prompt(ModelId::Sam2, Prompt::Box([0.0, 0.0, f32::NAN, 1.0])).is_err()); - } - - /// Explicit developer opt-in only. No normal test or first launch downloads weights. - #[test] - #[ignore = "requires PHOTOCRAFT_MODEL_TEST_DIR; PHOTOCRAFT_MODEL_TEST_DOWNLOAD=1 explicitly downloads ~1.8 GB"] - fn real_models_cpu_smoke() { - let root = std::env::var_os("PHOTOCRAFT_MODEL_TEST_DIR").expect("set a dedicated model test directory"); - let backend = NativeBackend::new(root.into()); - let mut image = RgbImage::new(192, 128); - for (i, p) in image.px.iter_mut().enumerate() { - let (x, y) = ((i % 192) as i32 - 96, (i / 192) as i32 - 64); - *p = if x * x + y * y < 45 * 45 { [0.9, 0.2, 0.1] } else { [0.1, 0.4, 0.7] }; - } - if std::env::var("PHOTOCRAFT_MODEL_TEST_DOWNLOAD").as_deref() == Ok("1") { - for id in [ModelId::BiRefNet, ModelId::Sam2] { - eprintln!("Downloading / verifying {}", id.name()); - backend.download(id, &Interrupt::NONE).unwrap(); - } - } - for id in [ModelId::BiRefNet, ModelId::Sam2] { - let prompt = if id == ModelId::Sam2 { Prompt::Box([0.2, 0.1, 0.8, 0.9]) } else { Prompt::Subject }; - let start = std::time::Instant::now(); - let mask = backend.infer(id, &image, prompt, &Interrupt::NONE).unwrap(); - mask.validate().unwrap(); - assert!(mask.values.iter().any(|v| v.abs() > 0.01)); - eprintln!("{} CPU: {:.2}s; mask {}x{}", id.name(), start.elapsed().as_secs_f64(), mask.width, mask.height); - } - } -} diff --git a/crates/ml/src/test_models.rs b/crates/ml/src/test_models.rs deleted file mode 100644 index fd31fccbb5..0000000000 --- a/crates/ml/src/test_models.rs +++ /dev/null @@ -1,45 +0,0 @@ -//! Original synthetic ONNX protobufs: channel mean → sigmoid; constant embeddings; three -//! scored masks. No learned weights, network, Python runtime or external assets in CI. -//! Shapes and names deliberately match the reviewed export adapters, not model quality. -pub(super) const MATTE: &[u8] = &[ - 8, 9, 58, 237, 1, 10, 43, 18, 4, 97, 120, 101, 115, 34, 8, 67, 111, 110, 115, 116, 97, 110, 116, 42, 25, 10, 5, 118, 97, 108, 117, 101, 42, 13, 8, 1, 16, - 7, 58, 1, 1, 66, 4, 97, 120, 101, 115, 160, 1, 4, 10, 48, 10, 5, 105, 109, 97, 103, 101, 10, 4, 97, 120, 101, 115, 18, 4, 109, 101, 97, 110, 34, 10, 82, - 101, 100, 117, 99, 101, 77, 101, 97, 110, 42, 15, 10, 8, 107, 101, 101, 112, 100, 105, 109, 115, 24, 1, 160, 1, 2, 10, 22, 10, 4, 109, 101, 97, 110, 18, 5, - 97, 108, 112, 104, 97, 34, 7, 83, 105, 103, 109, 111, 105, 100, 18, 46, 80, 104, 111, 116, 111, 67, 114, 97, 102, 116, 32, 111, 114, 105, 103, 105, 110, - 97, 108, 32, 115, 121, 110, 116, 104, 101, 116, 105, 99, 32, 99, 111, 110, 116, 114, 97, 99, 116, 32, 102, 105, 120, 116, 117, 114, 101, 90, 33, 10, 5, - 105, 109, 97, 103, 101, 18, 24, 10, 22, 8, 1, 18, 18, 10, 2, 8, 1, 10, 2, 8, 3, 10, 3, 8, 128, 16, 10, 3, 8, 128, 16, 98, 33, 10, 5, 97, 108, 112, 104, 97, - 18, 24, 10, 22, 8, 1, 18, 18, 10, 2, 8, 1, 10, 2, 8, 1, 10, 3, 8, 128, 16, 10, 3, 8, 128, 16, 66, 4, 10, 0, 16, 18, -]; -pub(super) const ENCODER: &[u8] = &[ - 8, 9, 58, 218, 3, 10, 80, 18, 18, 105, 109, 97, 103, 101, 95, 101, 109, 98, 101, 100, 100, 105, 110, 103, 115, 46, 48, 34, 8, 67, 111, 110, 115, 116, 97, - 110, 116, 42, 48, 10, 5, 118, 97, 108, 117, 101, 42, 36, 8, 1, 8, 1, 8, 1, 8, 1, 16, 1, 34, 4, 0, 0, 0, 0, 66, 18, 105, 109, 97, 103, 101, 95, 101, 109, - 98, 101, 100, 100, 105, 110, 103, 115, 46, 48, 160, 1, 4, 10, 80, 18, 18, 105, 109, 97, 103, 101, 95, 101, 109, 98, 101, 100, 100, 105, 110, 103, 115, 46, - 49, 34, 8, 67, 111, 110, 115, 116, 97, 110, 116, 42, 48, 10, 5, 118, 97, 108, 117, 101, 42, 36, 8, 1, 8, 1, 8, 1, 8, 1, 16, 1, 34, 4, 0, 0, 128, 63, 66, - 18, 105, 109, 97, 103, 101, 95, 101, 109, 98, 101, 100, 100, 105, 110, 103, 115, 46, 49, 160, 1, 4, 10, 80, 18, 18, 105, 109, 97, 103, 101, 95, 101, 109, - 98, 101, 100, 100, 105, 110, 103, 115, 46, 50, 34, 8, 67, 111, 110, 115, 116, 97, 110, 116, 42, 48, 10, 5, 118, 97, 108, 117, 101, 42, 36, 8, 1, 8, 1, 8, - 1, 8, 1, 16, 1, 34, 4, 0, 0, 0, 64, 66, 18, 105, 109, 97, 103, 101, 95, 101, 109, 98, 101, 100, 100, 105, 110, 103, 115, 46, 50, 160, 1, 4, 18, 46, 80, - 104, 111, 116, 111, 67, 114, 97, 102, 116, 32, 111, 114, 105, 103, 105, 110, 97, 108, 32, 115, 121, 110, 116, 104, 101, 116, 105, 99, 32, 99, 111, 110, - 116, 114, 97, 99, 116, 32, 102, 105, 120, 116, 117, 114, 101, 90, 40, 10, 12, 112, 105, 120, 101, 108, 95, 118, 97, 108, 117, 101, 115, 18, 24, 10, 22, 8, - 1, 18, 18, 10, 2, 8, 1, 10, 2, 8, 3, 10, 3, 8, 128, 8, 10, 3, 8, 128, 8, 98, 44, 10, 18, 105, 109, 97, 103, 101, 95, 101, 109, 98, 101, 100, 100, 105, 110, - 103, 115, 46, 48, 18, 22, 10, 20, 8, 1, 18, 16, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 1, 98, 44, 10, 18, 105, 109, 97, 103, 101, 95, 101, 109, - 98, 101, 100, 100, 105, 110, 103, 115, 46, 49, 18, 22, 10, 20, 8, 1, 18, 16, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 1, 98, 44, 10, 18, 105, 109, - 97, 103, 101, 95, 101, 109, 98, 101, 100, 100, 105, 110, 103, 115, 46, 50, 18, 22, 10, 20, 8, 1, 18, 16, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, - 1, 66, 4, 10, 0, 16, 18, -]; -pub(super) const DECODER: &[u8] = &[ - 8, 9, 58, 149, 4, 10, 86, 18, 10, 112, 114, 101, 100, 95, 109, 97, 115, 107, 115, 34, 8, 67, 111, 110, 115, 116, 97, 110, 116, 42, 62, 10, 5, 118, 97, 108, - 117, 101, 42, 50, 8, 1, 8, 1, 8, 3, 8, 1, 8, 2, 16, 1, 34, 24, 0, 0, 128, 191, 0, 0, 0, 192, 0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 128, 64, 0, 0, 160, 64, 66, - 10, 112, 114, 101, 100, 95, 109, 97, 115, 107, 115, 160, 1, 4, 10, 70, 18, 10, 105, 111, 117, 95, 115, 99, 111, 114, 101, 115, 34, 8, 67, 111, 110, 115, - 116, 97, 110, 116, 42, 46, 10, 5, 118, 97, 108, 117, 101, 42, 34, 8, 1, 8, 1, 8, 3, 16, 1, 34, 12, 205, 204, 204, 61, 102, 102, 102, 63, 205, 204, 76, 62, - 66, 10, 105, 111, 117, 95, 115, 99, 111, 114, 101, 115, 160, 1, 4, 18, 46, 80, 104, 111, 116, 111, 67, 114, 97, 102, 116, 32, 111, 114, 105, 103, 105, 110, - 97, 108, 32, 115, 121, 110, 116, 104, 101, 116, 105, 99, 32, 99, 111, 110, 116, 114, 97, 99, 116, 32, 102, 105, 120, 116, 117, 114, 101, 90, 38, 10, 12, - 105, 110, 112, 117, 116, 95, 112, 111, 105, 110, 116, 115, 18, 22, 10, 20, 8, 1, 18, 16, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 2, 90, 34, 10, - 12, 105, 110, 112, 117, 116, 95, 108, 97, 98, 101, 108, 115, 18, 18, 10, 16, 8, 7, 18, 12, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 1, 90, 33, 10, 11, 105, 110, - 112, 117, 116, 95, 98, 111, 120, 101, 115, 18, 18, 10, 16, 8, 1, 18, 12, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 4, 90, 44, 10, 18, 105, 109, 97, 103, 101, 95, - 101, 109, 98, 101, 100, 100, 105, 110, 103, 115, 46, 48, 18, 22, 10, 20, 8, 1, 18, 16, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 1, 90, 44, 10, 18, - 105, 109, 97, 103, 101, 95, 101, 109, 98, 101, 100, 100, 105, 110, 103, 115, 46, 49, 18, 22, 10, 20, 8, 1, 18, 16, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 1, - 10, 2, 8, 1, 90, 44, 10, 18, 105, 109, 97, 103, 101, 95, 101, 109, 98, 101, 100, 100, 105, 110, 103, 115, 46, 50, 18, 22, 10, 20, 8, 1, 18, 16, 10, 2, 8, - 1, 10, 2, 8, 1, 10, 2, 8, 1, 10, 2, 8, 1, 98, 40, 10, 10, 112, 114, 101, 100, 95, 109, 97, 115, 107, 115, 18, 26, 10, 24, 8, 1, 18, 20, 10, 2, 8, 1, 10, 2, - 8, 1, 10, 2, 8, 3, 10, 2, 8, 1, 10, 2, 8, 2, 98, 32, 10, 10, 105, 111, 117, 95, 115, 99, 111, 114, 101, 115, 18, 18, 10, 16, 8, 1, 18, 12, 10, 2, 8, 1, 10, - 2, 8, 1, 10, 2, 8, 3, 66, 4, 10, 0, 16, 18, -]; diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index 5257b3dc4b..23ecfc3b09 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -7,10 +7,6 @@ license.workspace = true [lints] workspace = true -[features] -default = [] -local-ml = ["photocraft-engine/local-ml"] - [dependencies] craft-print = { workspace = true } craft-ui = { workspace = true } @@ -69,8 +65,6 @@ photocraft-testkit = { workspace = true } photocraft-psd = { workspace = true, features = ["testgen"] } # Isolated, self-cleaning folders for filesystem tests (the LUT folder, #6558). tempfile = "3" -# A deterministic local-model backend for the model-job tests (jobs_ui_tests.rs). -photocraft-ml = { workspace = true } [build-dependencies] # Deflates the translation catalogs and egui's default fonts (build.rs); already linked at run time to inflate them. diff --git a/crates/ui-egui/examples/snapshot.rs b/crates/ui-egui/examples/snapshot.rs index d3f6502612..7fa07a10bc 100644 --- a/crates/ui-egui/examples/snapshot.rs +++ b/crates/ui-egui/examples/snapshot.rs @@ -71,8 +71,6 @@ fn main() { let custom_titlebar = args.iter().any(|a| a == "--custom-titlebar"); // `--settle-ms N`: keep rendering frames for N ms before the capture (e.g. mid-job). let settle_ms: u64 = arg(&args, "--settle-ms").and_then(|s| s.parse().ok()).unwrap_or(0); - #[cfg(feature = "local-ml")] - let models_dir = arg(&args, "--models-dir"); let mut render_options = eframe::egui_wgpu::RendererOptions::PREDICTABLE; render_options.predictable_texture_filtering = !args.iter().any(|a| a == "--hardware-filtering"); let mut harness = egui_kittest::Harness::builder() @@ -86,16 +84,7 @@ fn main() { let mut services = services; services.is_wayland = wayland_notice; services.xwayland_command = wayland_notice.then(|| "WAYLAND_DISPLAY= photocraft".into()); - let session = photocraft_engine::Session::new(); - #[cfg(feature = "local-ml")] - let session = { - let mut session = session; - if let Some(dir) = models_dir { - session.configure_local_models(dir.into()); - } - session - }; - let mut app = PhotocraftApp::new(session, services); + let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), services); if update_notice { app.session.updates.status = photocraft_engine::updates_cmds::Status::Available { release: photocraft_engine::updates_cmds::Release { diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index da0aa8f6f2..0bb2b15135 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4198,22 +4198,3 @@ cameraRaw Dehaze Odstranění oparu Tight Curl Těsná smyčka Loose Curl Volná smyčka Stylized dabs from a history state Stylizované šmouhy ze stavu historie -# Optional local selection models. - Subject / background removal Výběr subjektu / odstranění pozadí - Object selection Výběr objektu - Classical (built in) Klasická metoda (vestavěná) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Stáhnout - Download a model before choosing it. Downloads do not change the current method. Před výběrem model stáhněte. Stažení nemění aktuální metodu. - Downloaded Staženo - In use… Používá se… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Velké modely mohou trvat déle a použít několik GB paměti. Průběh a Zrušit se zobrazují na stavovém řádku. - Local models aren't available in this build or session. Místní modely nejsou v tomto sestavení nebo relaci dostupné. - Local selection models Místní modely výběru - Model details Podrobnosti modelu - Models run on this device. Images stay on this device. Modely běží na tomto zařízení. Obrázky zůstávají na tomto zařízení. - Not downloaded Nestaženo - Remove download Odstranit stažený model - Select Subject and Remove Background; detailed, soft edges Vybrat objekt a odstranit pozadí; podrobné, měkké okraje - Object Selection; drag a box around the object Výběr objektu; nakreslete rámeček kolem objektu diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index c3f7e4e7e0..6ce1f80274 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3466,22 +3466,3 @@ curves Smooth Glätten Tight Curl Eng gewellt Loose Curl Locker gewellt Stylized dabs from a history state Stilisierte Tupfer aus einem Protokollzustand -# Optional local selection models. - Subject / background removal Motiv / Hintergrund entfernen - Object selection Objektauswahl - Classical (built in) Klassische Methode (integriert) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Herunterladen - Download a model before choosing it. Downloads do not change the current method. Laden Sie ein Modell herunter, bevor Sie es auswählen. Downloads ändern die aktuelle Methode nicht. - Downloaded Heruntergeladen - In use… Wird verwendet… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Große Modelle können Zeit und mehrere GB Arbeitsspeicher benötigen. Fortschritt und Abbrechen erscheinen in der Statusleiste. - Local models aren't available in this build or session. Lokale Modelle sind in diesem Build oder dieser Sitzung nicht verfügbar. - Local selection models Lokale Auswahlmodelle - Model details Modelldetails - Models run on this device. Images stay on this device. Modelle laufen auf diesem Gerät. Bilder bleiben auf diesem Gerät. - Not downloaded Nicht heruntergeladen - Remove download Download entfernen - Select Subject and Remove Background; detailed, soft edges Motiv auswählen und Hintergrund entfernen; detaillierte, weiche Kanten - Object Selection; drag a box around the object Objektauswahl; einen Rahmen um das Objekt ziehen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 529d6bc668..e6ecd1a010 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -4150,22 +4150,3 @@ curves Smooth Εξομάλυνση Tight Curl Σφιχτή μπούκλα Loose Curl Χαλαρή μπούκλα Stylized dabs from a history state Στυλιζαρισμένες πινελιές από μια κατάσταση ιστορικού -# Optional local selection models. - Subject / background removal Θέμα / αφαίρεση φόντου - Object selection Επιλογή αντικειμένου - Classical (built in) Κλασική μέθοδος (ενσωματωμένη) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Λήψη - Download a model before choosing it. Downloads do not change the current method. Κάντε λήψη ενός μοντέλου πριν το επιλέξετε. Οι λήψεις δεν αλλάζουν την τρέχουσα μέθοδο. - Downloaded Έγινε λήψη - In use… Σε χρήση… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Τα μεγάλα μοντέλα μπορεί να χρειαστούν χρόνο και αρκετά GB μνήμης. Η πρόοδος και η Ακύρωση εμφανίζονται στη γραμμή κατάστασης. - Local models aren't available in this build or session. Τα τοπικά μοντέλα δεν είναι διαθέσιμα σε αυτή την έκδοση ή συνεδρία. - Local selection models Τοπικά μοντέλα επιλογής - Model details Λεπτομέρειες μοντέλου - Models run on this device. Images stay on this device. Τα μοντέλα εκτελούνται σε αυτή τη συσκευή. Οι εικόνες παραμένουν σε αυτή τη συσκευή. - Not downloaded Δεν έχει γίνει λήψη - Remove download Διαγραφή λήψης - Select Subject and Remove Background; detailed, soft edges Επιλογή θέματος και αφαίρεση φόντου· λεπτομερή, απαλά όρια - Object Selection; drag a box around the object Επιλογή αντικειμένου· σύρετε ένα πλαίσιο γύρω από το αντικείμενο diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index fb0812b230..20c0d62e2c 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -4412,22 +4412,3 @@ navigator Zoom Zoom Tight Curl Rizo apretado Loose Curl Rizo suelto Stylized dabs from a history state Toques estilizados desde un estado del historial -# Optional local selection models. - Subject / background removal Sujeto / eliminación del fondo - Object selection Selección de objetos - Classical (built in) Método clásico (incluido) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Descargar - Download a model before choosing it. Downloads do not change the current method. Descarga un modelo antes de elegirlo. Las descargas no cambian el método actual. - Downloaded Descargado - In use… En uso… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Los modelos grandes pueden tardar y usar varios GB de memoria. El progreso y Cancelar aparecen en la barra de estado. - Local models aren't available in this build or session. Los modelos locales no están disponibles en esta compilación o sesión. - Local selection models Modelos de selección locales - Model details Detalles del modelo - Models run on this device. Images stay on this device. Los modelos se ejecutan en este dispositivo. Las imágenes permanecen en este dispositivo. - Not downloaded Sin descargar - Remove download Eliminar descarga - Select Subject and Remove Background; detailed, soft edges Seleccionar sujeto y eliminar fondo; bordes suaves y detallados - Object Selection; drag a box around the object Selección de objetos; dibuja un recuadro alrededor del objeto diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 28fcc1be58..7085401552 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -4492,22 +4492,3 @@ shape Appearance Apparence Tight Curl Boucle serrée Loose Curl Boucle lâche Stylized dabs from a history state Touches stylisées depuis un état d'historique -# Optional local selection models. - Subject / background removal Sujet / suppression de l’arrière-plan - Object selection Sélection d’objet - Classical (built in) Méthode classique (intégrée) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Télécharger - Download a model before choosing it. Downloads do not change the current method. Téléchargez un modèle avant de le choisir. Le téléchargement ne change pas la méthode actuelle. - Downloaded Téléchargé - In use… En cours d’utilisation… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Les grands modèles peuvent prendre du temps et utiliser plusieurs Go de mémoire. La progression et Annuler apparaissent dans la barre d’état. - Local models aren't available in this build or session. Les modèles locaux ne sont pas disponibles dans cette version ou session. - Local selection models Modèles de sélection locaux - Model details Détails du modèle - Models run on this device. Images stay on this device. Les modèles s’exécutent sur cet appareil. Les images restent sur cet appareil. - Not downloaded Non téléchargé - Remove download Supprimer le téléchargement - Select Subject and Remove Background; detailed, soft edges Sélectionner le sujet et supprimer l’arrière-plan ; contours fins et doux - Object Selection; drag a box around the object Sélection d’objet ; tracer un cadre autour de l’objet diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0a023fb387..c40735a26a 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -4365,22 +4365,3 @@ cameraRaw Yellow Sárga Tight Curl Szoros göndör Loose Curl Laza göndör Stylized dabs from a history state Stilizált pöttyök egy előzményállapotból -# Optional local selection models. - Subject / background removal Téma / háttér eltávolítása - Object selection Objektum kijelölése - Classical (built in) Klasszikus (beépített) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Letöltés - Download a model before choosing it. Downloads do not change the current method. Választás előtt töltsön le egy modellt. A letöltés nem változtatja meg a jelenlegi módszert. - Downloaded Letöltve - In use… Használatban… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. A nagy modellek futtatása időt igényelhet, és több GB memóriát használhat. Az előrehaladás és a Mégse az állapotsávon látható. - Local models aren't available in this build or session. A helyi modellek nem érhetők el ebben a verzióban vagy munkamenetben. - Local selection models Helyi kijelölési modellek - Model details Modell részletei - Models run on this device. Images stay on this device. A modellek ezen az eszközön futnak. A képek ezen az eszközön maradnak. - Not downloaded Nincs letöltve - Remove download Letöltés eltávolítása - Select Subject and Remove Background; detailed, soft edges Téma kijelölése és háttér eltávolítása; részletes, lágy szélek - Object Selection; drag a box around the object Objektum kijelölése; húzzon keretet az objektum köré diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 765c4657dc..3012fd4db1 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3467,22 +3467,3 @@ curves Smooth Haluskan Loose Curl Ikal longgar Area Area Stylized dabs from a history state Cap bergaya dari sebuah keadaan riwayat -# Optional local selection models. - Subject / background removal Subjek / penghapusan latar belakang - Object selection Seleksi objek - Classical (built in) Metode klasik (bawaan) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Unduh - Download a model before choosing it. Downloads do not change the current method. Unduh model sebelum memilihnya. Unduhan tidak mengubah metode saat ini. - Downloaded Sudah diunduh - In use… Sedang digunakan… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Model besar dapat membutuhkan waktu dan beberapa GB memori. Progres dan Batal muncul di bilah status. - Local models aren't available in this build or session. Model lokal tidak tersedia dalam build atau sesi ini. - Local selection models Model seleksi lokal - Model details Detail model - Models run on this device. Images stay on this device. Model dijalankan di perangkat ini. Gambar tetap berada di perangkat ini. - Not downloaded Belum diunduh - Remove download Hapus unduhan - Select Subject and Remove Background; detailed, soft edges Pilih Subjek dan Hapus Latar Belakang; tepi halus dan terperinci - Object Selection; drag a box around the object Pemilihan Objek; seret kotak di sekitar objek diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index d3ee36c3aa..700d120cff 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -4567,22 +4567,3 @@ shape Appearance Aspetto Tight Curl Riccio stretto Loose Curl Riccio largo Stylized dabs from a history state Tocchi stilizzati da uno stato della storia -# Optional local selection models. - Subject / background removal Soggetto / rimozione dello sfondo - Object selection Selezione oggetti - Classical (built in) Metodo classico (integrato) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Scarica - Download a model before choosing it. Downloads do not change the current method. Scarica un modello prima di sceglierlo. Il download non cambia il metodo attuale. - Downloaded Scaricato - In use… In uso… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. I modelli grandi possono richiedere tempo e diversi GB di memoria. Avanzamento e Annulla appaiono nella barra di stato. - Local models aren't available in this build or session. I modelli locali non sono disponibili in questa build o sessione. - Local selection models Modelli di selezione locali - Model details Dettagli del modello - Models run on this device. Images stay on this device. I modelli vengono eseguiti su questo dispositivo. Le immagini restano su questo dispositivo. - Not downloaded Non scaricato - Remove download Rimuovi download - Select Subject and Remove Background; detailed, soft edges Seleziona soggetto e rimuovi sfondo; bordi morbidi e dettagliati - Object Selection; drag a box around the object Selezione oggetto; trascina un riquadro attorno all’oggetto diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index cf5ada0d81..85e3f0f8e6 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -4130,22 +4130,3 @@ curves Smooth スムーズ Tight Curl タイトカール Loose Curl ルーズカール Stylized dabs from a history state 履歴状態から様式化したダブを描きます -# Optional local selection models. - Subject / background removal 被写体選択 / 背景の削除 - Object selection オブジェクト選択 - Classical (built in) 従来の方法(内蔵) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download ダウンロード - Download a model before choosing it. Downloads do not change the current method. モデルをダウンロードしてから選択してください。ダウンロードだけでは現在の方法は変わりません。 - Downloaded ダウンロード済み - In use… 使用中… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. 大きなモデルは時間と数GBのメモリを使う場合があります。進捗とキャンセルはステータスバーに表示されます。 - Local models aren't available in this build or session. このビルドまたはセッションではローカルモデルを利用できません。 - Local selection models ローカル選択モデル - Model details モデルの詳細 - Models run on this device. Images stay on this device. モデルはこのデバイス上で実行されます。画像はこのデバイス上に留まります。 - Not downloaded 未ダウンロード - Remove download ダウンロードを削除 - Select Subject and Remove Background; detailed, soft edges 被写体を選択して背景を削除。細部を保った柔らかなエッジ - Object Selection; drag a box around the object オブジェクト選択。オブジェクトを囲む矩形をドラッグ diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 63991c6589..e9b0cb26d4 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3664,22 +3664,3 @@ curves Smooth 매끄럽게 Tight Curl 타이트 컬 Loose Curl 루즈 컬 Stylized dabs from a history state 작업 내역 상태에서 양식화된 찍기 -# Optional local selection models. - Subject / background removal 피사체 선택 / 배경 제거 - Object selection 개체 선택 - Classical (built in) 기존 방식 (내장) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download 다운로드 - Download a model before choosing it. Downloads do not change the current method. 모델을 다운로드한 후 선택하세요. 다운로드는 현재 방식을 변경하지 않습니다. - Downloaded 다운로드됨 - In use… 사용 중… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. 큰 모델은 시간이 걸리고 수 GB의 메모리를 사용할 수 있습니다. 진행률과 취소는 상태 표시줄에 나타납니다. - Local models aren't available in this build or session. 이 빌드 또는 세션에서는 로컬 모델을 사용할 수 없습니다. - Local selection models 로컬 선택 모델 - Model details 모델 세부 정보 - Models run on this device. Images stay on this device. 모델은 이 기기에서 실행됩니다. 이미지는 이 기기에 보관됩니다. - Not downloaded 다운로드되지 않음 - Remove download 다운로드 삭제 - Select Subject and Remove Background; detailed, soft edges 피사체 선택 및 배경 제거; 섬세하고 부드러운 가장자리 - Object Selection; drag a box around the object 개체 선택; 개체 주위에 상자를 드래그하세요 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 552732150a..1f2b36c2df 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4210,22 +4210,3 @@ curves Smooth Vloeiend maken Tight Curl Strakke krul Loose Curl Losse krul Stylized dabs from a history state Gestileerde tikken uit een historiestatus -# Optional local selection models. - Subject / background removal Onderwerp / achtergrond verwijderen - Object selection Objectselectie - Classical (built in) Klassiek (ingebouwd) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Downloaden - Download a model before choosing it. Downloads do not change the current method. Download een model voordat u het kiest. Downloads wijzigen de huidige methode niet. - Downloaded Gedownload - In use… In gebruik… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Grote modellen kunnen lang duren en meerdere GB geheugen gebruiken. Voortgang en Annuleren verschijnen in de statusbalk. - Local models aren't available in this build or session. Lokale modellen zijn niet beschikbaar in deze build of sessie. - Local selection models Lokale selectiemodellen - Model details Modeldetails - Models run on this device. Images stay on this device. Modellen draaien op dit apparaat. Afbeeldingen blijven op dit apparaat. - Not downloaded Niet gedownload - Remove download Download verwijderen - Select Subject and Remove Background; detailed, soft edges Onderwerp selecteren en achtergrond verwijderen; gedetailleerde, zachte randen - Object Selection; drag a box around the object Objectselectie; sleep een kader rond het object diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 41448a9037..3acc77dd61 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4068,22 +4068,3 @@ curves Smooth Wygładź Tight Curl Ścisły lok Loose Curl Luźny lok Stylized dabs from a history state Stylizowane plamy ze stanu historii -# Optional local selection models. - Subject / background removal Temat / usuwanie tła - Object selection Zaznaczanie obiektów - Classical (built in) Metoda klasyczna (wbudowana) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Pobierz - Download a model before choosing it. Downloads do not change the current method. Pobierz model przed jego wybraniem. Pobieranie nie zmienia bieżącej metody. - Downloaded Pobrano - In use… W użyciu… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Duże modele mogą potrzebować czasu i kilku GB pamięci. Postęp i przycisk Anuluj są wyświetlane na pasku stanu. - Local models aren't available in this build or session. Modele lokalne nie są dostępne w tej wersji lub sesji. - Local selection models Lokalne modele zaznaczania - Model details Szczegóły modelu - Models run on this device. Images stay on this device. Modele działają na tym urządzeniu. Obrazy pozostają na tym urządzeniu. - Not downloaded Nie pobrano - Remove download Usuń pobrany model - Select Subject and Remove Background; detailed, soft edges Zaznacz temat i Usuń tło; szczegółowe, miękkie krawędzie - Object Selection; drag a box around the object Zaznaczanie obiektów; przeciągnij prostokąt wokół obiektu diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 380c424b55..7584dd705c 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -4380,22 +4380,3 @@ layerLabel No Color Sem cor Tight Curl Curva cerrada Loose Curl Curva solta Stylized dabs from a history state Toques estilizados a partir de um estado do histórico -# Optional local selection models. - Subject / background removal Assunto / remoção de fundo - Object selection Seleção de objetos - Classical (built in) Método clássico (incluído) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Baixar - Download a model before choosing it. Downloads do not change the current method. Baixe um modelo antes de escolhê-lo. O download não altera o método atual. - Downloaded Baixado - In use… Em uso… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Modelos grandes podem demorar e usar vários GB de memória. O progresso e Cancelar aparecem na barra de status. - Local models aren't available in this build or session. Modelos locais não estão disponíveis nesta versão ou sessão. - Local selection models Modelos de seleção locais - Model details Detalhes do modelo - Models run on this device. Images stay on this device. Os modelos são executados neste dispositivo. As imagens permanecem neste dispositivo. - Not downloaded Não baixado - Remove download Remover download - Select Subject and Remove Background; detailed, soft edges Selecionar assunto e remover fundo; bordas suaves e detalhadas - Object Selection; drag a box around the object Seleção de objeto; arraste uma caixa ao redor do objeto diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index f0a228e603..cfd4d7c737 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -4653,22 +4653,3 @@ shape Appearance Оформление Tight Curl Плотный завиток Loose Curl Свободный завиток Stylized dabs from a history state Стилизованные мазки из состояния истории -# Optional local selection models. - Subject / background removal Выделение объекта / удаление фона - Object selection Выделение объектов - Classical (built in) Классический метод (встроенный) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Скачать - Download a model before choosing it. Downloads do not change the current method. Скачайте модель перед выбором. Скачивание не меняет текущий метод. - Downloaded Скачано - In use… Используется… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Большие модели могут требовать времени и нескольких ГБ памяти. Прогресс и отмена доступны в строке состояния. - Local models aren't available in this build or session. Локальные модели недоступны в этой сборке или сеансе. - Local selection models Локальные модели выделения - Model details Подробнее о модели - Models run on this device. Images stay on this device. Модели работают на этом устройстве. Изображения остаются на этом устройстве. - Not downloaded Не скачано - Remove download Удалить скачанное - Select Subject and Remove Background; detailed, soft edges Выделение объекта и удаление фона; детализированные мягкие края - Object Selection; drag a box around the object Выделение объекта; обведите объект прямоугольником diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv index f52d941b7a..3c5ece3ecc 100644 --- a/crates/ui-egui/src/i18n/sr.tsv +++ b/crates/ui-egui/src/i18n/sr.tsv @@ -4523,22 +4523,3 @@ shape Appearance Izgled Tight Curl Usko uvijeno Loose Curl Labavo uvijeno Stylized dabs from a history state Stilizovane mrlje iz stanja istorije -# Optional local selection models. - Subject / background removal Subjekat / uklanjanje pozadine - Object selection Izbor objekta - Classical (built in) Klasično (ugrađeno) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Preuzmi - Download a model before choosing it. Downloads do not change the current method. Preuzmite model pre izbora. Preuzimanje ne menja trenutnu metodu. - Downloaded Preuzeto - In use… U upotrebi… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Velikim modelima može trebati više vremena i nekoliko GB memorije. Napredak i Otkaži prikazuju se na statusnoj traci. - Local models aren't available in this build or session. Lokalni modeli nisu dostupni u ovoj verziji ili sesiji. - Local selection models Lokalni modeli za izbor - Model details Detalji modela - Models run on this device. Images stay on this device. Modeli rade na ovom uređaju. Slike ostaju na ovom uređaju. - Not downloaded Nije preuzeto - Remove download Ukloni preuzimanje - Select Subject and Remove Background; detailed, soft edges Izbor subjekta i uklanjanje pozadine; detaljne, meke ivice - Object Selection; drag a box around the object Izbor objekta; prevucite okvir oko objekta diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 791e7385a2..412b967873 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -4179,22 +4179,3 @@ cameraData Lens Lens Tight Curl Sıkı Kıvrım Loose Curl Gevşek Kıvrım Stylized dabs from a history state Bir geçmiş durumundan stilize benekler -# Optional local selection models. - Subject / background removal Konu / arka plan kaldırma - Object selection Nesne seçimi - Classical (built in) Klasik (yerleşik) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download İndir - Download a model before choosing it. Downloads do not change the current method. Seçmeden önce bir model indirin. İndirme işlemi geçerli yöntemi değiştirmez. - Downloaded İndirildi - In use… Kullanımda… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Büyük modeller zaman alabilir ve birkaç GB bellek kullanabilir. İlerleme ve İptal durum çubuğunda görünür. - Local models aren't available in this build or session. Yerel modeller bu derlemede veya oturumda kullanılamıyor. - Local selection models Yerel seçim modelleri - Model details Model ayrıntıları - Models run on this device. Images stay on this device. Modeller bu cihazda çalışır. Görüntüler bu cihazda kalır. - Not downloaded İndirilmedi - Remove download İndirmeyi kaldır - Select Subject and Remove Background; detailed, soft edges Konu Seç ve Arka Planı Kaldır; ayrıntılı, yumuşak kenarlar - Object Selection; drag a box around the object Nesne Seçimi; nesnenin etrafına bir kutu sürükleyin diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index c7bbaf7d43..ff5afa42bd 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -4161,22 +4161,3 @@ curves Smooth Згладити Tight Curl Щільний завиток Loose Curl Вільний завиток Stylized dabs from a history state Стилізовані мазки зі стану історії -# Optional local selection models. - Subject / background removal Об’єкт / видалення тла - Object selection Вибір об’єкта - Classical (built in) Класичний (вбудований) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Завантажити - Download a model before choosing it. Downloads do not change the current method. Завантажте модель перед вибором. Завантаження не змінюють поточний метод. - Downloaded Завантажено - In use… Використовується… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Великі моделі можуть працювати довго та використовувати кілька ГБ пам’яті. Прогрес і Скасувати з’являються в рядку стану. - Local models aren't available in this build or session. Локальні моделі недоступні в цій збірці або сеансі. - Local selection models Локальні моделі вибору - Model details Відомості про модель - Models run on this device. Images stay on this device. Моделі працюють на цьому пристрої. Зображення залишаються на цьому пристрої. - Not downloaded Не завантажено - Remove download Видалити завантаження - Select Subject and Remove Background; detailed, soft edges Вибір об’єкта та видалення тла; докладні, м’які краї - Object Selection; drag a box around the object Вибір об’єкта; перетягніть рамку навколо об’єкта diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 21dabccf30..d56fb6f20b 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3946,22 +3946,3 @@ curves Smooth Làm mượt Tight Curl Xoắn chặt Loose Curl Xoắn lỏng Stylized dabs from a history state Các chấm cách điệu từ một trạng thái lịch sử -# Optional local selection models. - Subject / background removal Chủ thể / xóa nền - Object selection Chọn đối tượng - Classical (built in) Phương pháp cổ điển (tích hợp) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download Tải xuống - Download a model before choosing it. Downloads do not change the current method. Tải mô hình trước khi chọn. Việc tải xuống không thay đổi phương pháp hiện tại. - Downloaded Đã tải xuống - In use… Đang sử dụng… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. Mô hình lớn có thể mất thời gian và dùng vài GB bộ nhớ. Tiến trình và nút Hủy xuất hiện trên thanh trạng thái. - Local models aren't available in this build or session. Mô hình cục bộ không khả dụng trong bản dựng hoặc phiên này. - Local selection models Mô hình chọn cục bộ - Model details Chi tiết mô hình - Models run on this device. Images stay on this device. Mô hình chạy trên thiết bị này. Hình ảnh vẫn ở trên thiết bị này. - Not downloaded Chưa tải xuống - Remove download Xóa bản tải xuống - Select Subject and Remove Background; detailed, soft edges Chọn chủ thể và xóa nền; giữ các cạnh mềm, chi tiết - Object Selection; drag a box around the object Chọn đối tượng; kéo một khung quanh đối tượng diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 69b0342edd..740006cb61 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3123,22 +3123,3 @@ curves Smooth 平滑 Loose Curl 宽松卷曲 Area 区域 Stylized dabs from a history state 从历史状态绘制风格化点涂 -# Optional local selection models. - Subject / background removal 主体选择 / 移除背景 - Object selection 对象选择 - Classical (built in) 传统方法(内置) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download 下载 - Download a model before choosing it. Downloads do not change the current method. 请先下载模型再选择。下载不会改变当前方法。 - Downloaded 已下载 - In use… 使用中… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. 大型模型可能耗时并占用数 GB 内存。进度和取消按钮显示在状态栏中。 - Local models aren't available in this build or session. 此版本或会话无法使用本地模型。 - Local selection models 本地选择模型 - Model details 模型详情 - Models run on this device. Images stay on this device. 模型在此设备上运行。图像保留在此设备上。 - Not downloaded 未下载 - Remove download 删除下载 - Select Subject and Remove Background; detailed, soft edges 选择主体和移除背景;精细、柔和的边缘 - Object Selection; drag a box around the object 对象选择;拖动矩形框以包围对象 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index db3d20aafc..729cbbf3ec 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -3079,22 +3079,3 @@ curves Smooth 平滑 Loose Curl 寬鬆捲曲 Area 區域 Stylized dabs from a history state 從歷史狀態繪製風格化點塗 -# Optional local selection models. - Subject / background removal 主體選取 / 移除背景 - Object selection 物件選取 - Classical (built in) 傳統方法(內建) - BiRefNet HR Matting BiRefNet HR Matting - SAM 2.1 Large SAM 2.1 Large - Download 下載 - Download a model before choosing it. Downloads do not change the current method. 請先下載模型再選擇。下載不會變更目前的方法。 - Downloaded 已下載 - In use… 使用中… - Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar. 大型模型可能耗時並使用數 GB 記憶體。進度與取消按鈕顯示在狀態列中。 - Local models aren't available in this build or session. 此版本或工作階段無法使用本機模型。 - Local selection models 本機選取模型 - Model details 模型詳細資訊 - Models run on this device. Images stay on this device. 模型在此裝置上執行。影像保留在此裝置上。 - Not downloaded 尚未下載 - Remove download 刪除下載 - Select Subject and Remove Background; detailed, soft edges 選取主體和移除背景;精細、柔和的邊緣 - Object Selection; drag a box around the object 物件選取;拖曳矩形框以包圍物件 diff --git a/crates/ui-egui/src/jobs_ui.rs b/crates/ui-egui/src/jobs_ui.rs index cc19a80dcd..43a6ceca10 100644 --- a/crates/ui-egui/src/jobs_ui.rs +++ b/crates/ui-egui/src/jobs_ui.rs @@ -525,22 +525,6 @@ fn on_event(app: &mut PhotocraftApp, ctx: &egui::Context, e: JobEvent) { app.sync_views(); crate::file_ui::print_status(app, result); } - // With a local model, Select Subject and Object Selection run as jobs: say when they found - // nothing, as `report_smart_result` does for the classical ones that finish at once. - JobOutcome::Done(ref v) - if matches!(e.command.as_str(), "select.subject" | "select.object") && v.get("changed").and_then(Value::as_bool) == Some(false) => - { - app.sync_views(); - app.ui.status = if e.command == "select.subject" && app.active_tool() == crate::state::Tool::ObjectSelection { - tl!("No subject found — try a rectangle around the object") - } else if e.command == "select.subject" { - tl!("No subject found — try Object Selection or the Lasso") - } else { - tl!("Object Selection found nothing there — try a tighter rectangle") - } - .into(); - app.ui.status_error = false; - } JobOutcome::Done(_) => { app.sync_views(); app.ui.status = e.label; diff --git a/crates/ui-egui/src/jobs_ui_tests.rs b/crates/ui-egui/src/jobs_ui_tests.rs index 18726ff8de..b9ff0f00a5 100644 --- a/crates/ui-egui/src/jobs_ui_tests.rs +++ b/crates/ui-egui/src/jobs_ui_tests.rs @@ -1091,48 +1091,3 @@ fn open_identity_keeps_same_poll_results_in_the_profile_queue() { assert!(app.held_opens.is_empty()); control.assert_untouched(&app); } - -/// A local model that never finds anything (an all-transparent mask). -struct EmptyModel; -impl photocraft_ml::InferenceBackend for EmptyModel { - fn status(&self) -> Vec { - photocraft_ml::MODELS.iter().map(|m| photocraft_ml::ModelStatus { id: m.id, installed: true, busy: false }).collect() - } - fn download(&self, _: photocraft_ml::ModelId, _: &photocraft_raster::Interrupt<'_>) -> photocraft_ml::Result<()> { - Ok(()) - } - fn remove(&self, _: photocraft_ml::ModelId, _: &photocraft_raster::Interrupt<'_>) -> photocraft_ml::Result<()> { - Ok(()) - } - fn infer( - &self, - _: photocraft_ml::ModelId, - _: &photocraft_algo::segment::RgbImage, - _: photocraft_ml::Prompt, - _: &photocraft_raster::Interrupt<'_>, - ) -> photocraft_ml::Result { - Ok(photocraft_ml::AlphaMask { width: 4, height: 4, values: vec![0.0; 16], kind: photocraft_ml::MaskKind::Alpha }) - } -} - -#[test] -fn a_model_selection_that_finds_nothing_says_so_like_the_classical_one() { - use crate::state::Tool; - // The same hints as the options bars' classical results (retouch_ui.rs). - for (tool, cmd, params, want) in [ - (Tool::QuickSelection, "select.subject", json!({"model": "birefnet-hr-matting"}), "No subject found — try Object Selection"), - (Tool::ObjectSelection, "select.subject", json!({"model": "birefnet-hr-matting"}), "No subject found — try a rectangle"), - (Tool::ObjectSelection, "select.object", json!({"model": "sam2.1-large", "rect": [40, 40, 120, 90]}), "Object Selection found nothing there"), - ] { - let mut h = app_harness(); - h.state_mut().ui.tool = tool; - h.state_mut().session.model_backend = Some(Arc::new(EmptyModel)); - let r = h.state_mut().run(cmd, params).unwrap(); - assert_eq!(r["pending"], true, "{cmd} runs as a job: {r}"); - frames_until(&mut h, 2, |h| h.state().session.jobs().is_empty()); - let app = h.state(); - assert!(app.ui.status.contains(want), "{cmd}: {}", app.ui.status); - assert!(!app.ui.status_error); - assert!(app.session.active().unwrap().doc.selection.is_none(), "{cmd} left the selection alone"); - } -} diff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rs index 6f646eba45..2f3327c337 100644 --- a/crates/ui-egui/src/prefs_ui.rs +++ b/crates/ui-egui/src/prefs_ui.rs @@ -1236,7 +1236,7 @@ pub fn body(app: &mut PhotocraftApp, ui: &mut egui::Ui, f: &mut Map shortcuts_body(app, ui, f), "presets" => presets_body(app, ui, f), @@ -1349,9 +1349,6 @@ fn choice_label(v: &str) -> String { "ahd" => "AHD (adaptive homogeneity)".into(), "mhc" => "Malvar–He–Cutler".into(), "cpu" => "CPU (no GPU acceleration)".into(), - "classical" => "Classical (built in)".into(), - "birefnet-hr-matting" => "BiRefNet HR Matting".into(), - "sam2.1-large" => "SAM 2.1 Large".into(), v => humanize(v), } } @@ -1390,7 +1387,7 @@ fn color_of(s: &str) -> Color32 { /// Search the same visible, editable preference labels used in the dialog. fn preference_matches(section: &str, key: &str, query: &str) -> bool { - let label = field_label(section, key); + let label = humanize(key); format!("{section}.{key}").to_lowercase().contains(query) || label.to_lowercase().contains(query) || tl!(&label).to_lowercase().contains(query) } @@ -1412,7 +1409,7 @@ fn preference_sections(values: &Value, search: &str) -> Vec<(&'static str, &'sta } /// Preferences: section list on the left, the section's settings on the right. -fn prefs_body(app: &mut PhotocraftApp, ui: &mut egui::Ui, f: &mut Map, system: Option) { +fn prefs_body(ui: &mut egui::Ui, f: &mut Map, system: Option) { let t = Tokens::get(ui.ctx()); let mut section = f.get("section").and_then(Value::as_str).unwrap_or("general").to_string(); let mut values = f.get("values").cloned().unwrap_or(Value::Null); @@ -1484,13 +1481,7 @@ fn prefs_body(app: &mut PhotocraftApp, ui: &mut egui::Ui, f: &mut Map) { - // The Preferences grid can leave a wider layout than its visible scroll area. Bound this - // child to the clip rectangle so long translations wrap inside the actual dialog. - let width = ui.available_width().min((ui.clip_rect().right() - ui.next_widget_position().x - 8.0).max(1.0)); - ui.scope(|ui| { - ui.set_max_width(width); - local_model_rows_inner(app, ui, obj); - }); -} - -fn local_model_rows_inner(app: &mut PhotocraftApp, ui: &mut egui::Ui, obj: &mut Map) { - let t = Tokens::get(ui.ctx()); - let status = app.session.local_model_status(); - let available = status["available"].as_bool().unwrap_or(false); - ui.add_space(10.0); - ui.label(RichText::new(tl!("Local selection models")).font(crate::theme::semibold(12.5)).color(t.text)); - ui.add(egui::Label::new(RichText::new(tl!("Models run on this device. Images stay on this device.")).color(t.text_dim)).wrap()); - ui.add(egui::Label::new(RichText::new(tl!("Download a model before choosing it. Downloads do not change the current method.")).color(t.text_dim)).wrap()); - if !available { - ui.add(egui::Label::new(RichText::new(tl!("Local models aren't available in this build or session.")).color(t.text_faint)).wrap()); - } - ui.add_space(6.0); - for model in status["models"].as_array().into_iter().flatten() { - let id = model["id"].as_str().unwrap_or_default(); - let label = model["label"].as_str().unwrap_or_default(); - let installed = model["installed"].as_bool().unwrap_or(false); - let busy = model["busy"].as_bool().unwrap_or(false); - let mib = model["downloadBytes"].as_u64().unwrap_or(0).div_ceil(1024 * 1024); - ui.push_id(id, |ui| { - ui.horizontal(|ui| { - ui.label(RichText::new(label).color(t.text)); - ui.label( - RichText::new(if busy { - tl!("In use…") - } else if installed { - tl!("Downloaded") - } else { - tl!("Not downloaded") - }) - .color(t.text_faint), - ); - }); - ui.add(egui::Label::new(RichText::new(tl!(model["purpose"].as_str().unwrap_or_default())).color(t.text_dim)).wrap()); - ui.horizontal(|ui| { - let button = if installed { tl!("Remove download").to_string() } else { format!("{} ({mib} MiB)", tl!("Download")) }; - let clicked = ui.add_enabled_ui(available && !busy, |ui| crate::widgets::secondary_button(ui, &button, 190.0).clicked()).inner; - if clicked { - let command = if installed { "models.remove" } else { "models.download" }; - if app.run(command, json!({"id": id})).is_ok() && installed { - let pref = if id == "sam2.1-large" { "objectModel" } else { "subjectModel" }; - obj.insert(pref.into(), json!("classical")); - } - } - ui.hyperlink_to(model["license"].as_str().unwrap_or_default(), model["upstream"].as_str().unwrap_or_default()); - ui.hyperlink_to(tl!("Model details"), model["exportSource"].as_str().unwrap_or_default()); - }); - ui.add_space(8.0); - }); - } - ui.add( - egui::Label::new( - RichText::new(tl!("Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar.")).color(t.text_faint), - ) - .wrap(), - ); -} - /// Preferences › Performance: what the app renders with now, and a reset of the GPU backend /// (a crashed start may have moved it to a safer choice). fn gpu_status_rows(ui: &mut egui::Ui, info: Option<&Value>, adapters: Option<&Value>, obj: &mut Map) { @@ -1850,22 +1769,19 @@ fn interface_groups(ui: &mut egui::Ui, obj: &mut Map, keys: &[Str pref_group(ui, "Appearance", |ui| { grid("interface-appearance").show(ui, |ui| { appearance_rows(ui, obj, system, rows); - field_rows(ui, "interface", obj, appearance, lang, &Value::Null); + field_rows(ui, "interface", obj, appearance, lang); }); }); } if !presentation.is_empty() { pref_group(ui, "Presentation", |ui| { - grid("interface-presentation").show(ui, |ui| field_rows(ui, "interface", obj, presentation, lang, &Value::Null)); + grid("interface-presentation").show(ui, |ui| field_rows(ui, "interface", obj, presentation, lang)); }); } if !checks.is_empty() || !other.is_empty() { pref_group(ui, "Options", |ui| { - egui::Grid::new("prefs-grid-interface-checks") - .num_columns(2) - .spacing([0.0, 7.0]) - .show(ui, |ui| field_rows(ui, "interface", obj, checks, lang, &Value::Null)); - grid("interface-options").show(ui, |ui| field_rows(ui, "interface", obj, other, lang, &Value::Null)); + egui::Grid::new("prefs-grid-interface-checks").num_columns(2).spacing([0.0, 7.0]).show(ui, |ui| field_rows(ui, "interface", obj, checks, lang)); + grid("interface-options").show(ui, |ui| field_rows(ui, "interface", obj, other, lang)); }); } } @@ -1879,27 +1795,6 @@ fn ctx_take_pick(ui: &egui::Ui) -> Option<(String, String)> { ui.ctx().data_mut(|d| d.remove_temp::<(String, String)>(egui::Id::new(PICK_ID))) } -fn field_label(section: &str, key: &str) -> String { - match (section, key) { - ("integrations", "subjectModel") => "Subject / background removal".into(), - ("integrations", "objectModel") => "Object selection".into(), - _ => humanize(key), - } -} - -fn model_choice_available(status: &Value, option: &str) -> bool { - option == "classical" - || (status["available"].as_bool().unwrap_or(false) - && status["models"].as_array().into_iter().flatten().any(|m| m["id"].as_str() == Some(option) && m["installed"].as_bool() == Some(true))) -} - -struct PreferenceFieldOptions<'a> { - lang: crate::i18n::Lang, - system: Option, - models: &'a Value, - search: &'a str, -} - /// Whether `section.key` gets a generic row for this search (`query`, lowercased; empty matches /// everything). Settings nothing reads yet stay out of the dialog (issue #204), as do those drawn /// by their own widgets; their stored values pass through untouched. @@ -1921,8 +1816,15 @@ fn field_visible(section: &str, obj: &Map, k: &str, query: &str) /// Generic editor for a section's fields: checkboxes, dropdowns for choices, colour swatches, /// number fields with the preference's range, text fields. -fn section_fields(ui: &mut egui::Ui, section: &str, obj: &mut Map, order: &[String], options: PreferenceFieldOptions<'_>) { - let PreferenceFieldOptions { lang, system, models, search } = options; +fn section_fields( + ui: &mut egui::Ui, + section: &str, + obj: &mut Map, + order: &[String], + lang: crate::i18n::Lang, + system: Option, + search: &str, +) { let query = search.to_lowercase(); let mut keys: Vec = order.iter().filter(|k| obj.contains_key(*k)).cloned().collect(); keys.extend(obj.keys().filter(|k| !order.contains(k)).cloned()); @@ -1937,7 +1839,7 @@ fn section_fields(ui: &mut egui::Ui, section: &str, obj: &mut Map memory_usage_row(ui, obj); } keys.retain(|k| field_visible(section, obj, k, &query)); - egui::Grid::new(("prefs-grid", section)).num_columns(2).spacing([14.0, 7.0]).show(ui, |ui| field_rows(ui, section, obj, keys, lang, models)); + egui::Grid::new(("prefs-grid", section)).num_columns(2).spacing([14.0, 7.0]).show(ui, |ui| field_rows(ui, section, obj, keys, lang)); } /// Explain the per-document RAM limit separately from the graphics-memory preference. @@ -1976,12 +1878,12 @@ fn read_at_launch(path: &str) -> bool { } /// One grid row per setting in `keys` (already filtered by `field_visible`). -fn field_rows(ui: &mut egui::Ui, section: &str, obj: &mut Map, keys: Vec, lang: crate::i18n::Lang, models: &Value) { +fn field_rows(ui: &mut egui::Ui, section: &str, obj: &mut Map, keys: Vec, lang: crate::i18n::Lang) { let t = Tokens::get(ui.ctx()); for k in keys { let path = format!("{section}.{k}"); let v = obj.get(&k).cloned().unwrap_or(Value::Null); - let human = field_label(section, &k); + let human = humanize(&k); let label = tl!(&human).to_string(); match &v { Value::Bool(b) => { @@ -2007,14 +1909,7 @@ fn field_rows(ui: &mut egui::Ui, section: &str, obj: &mut Map, ke } Value::String(s) if prefs::choices(&path).is_some() => { ui.label(RichText::new(tl!(&label)).color(t.text_dim)); - let opts: Vec<&str> = prefs::choices(&path) - .unwrap_or(&[]) - .iter() - .copied() - .filter(|v| { - !matches!(path.as_str(), "integrations.subjectModel" | "integrations.objectModel") || *v == s || model_choice_available(models, v) - }) - .collect(); + let opts = prefs::choices(&path).unwrap_or(&[]); let labels: Vec = opts.iter().map(|o| pref_choice_label(&path, o)).collect(); let pairs: Vec<(String, &str)> = opts.iter().map(|o| o.to_string()).zip(labels.iter().map(String::as_str)).collect(); let mut cur = s.clone(); @@ -2876,18 +2771,9 @@ mod tests { use egui_kittest::{Harness, kittest::Queryable}; let values = json!({"memoryUsageMb":50000}).as_object().unwrap().clone(); assert!(!field_visible("performance", &values, "memoryUsageMb", "")); - let mut h = Harness::builder().with_size(vec2(680.0, 350.0)).build_ui_state( - |ui, values| { - section_fields( - ui, - "performance", - values, - &["memoryUsageMb".into()], - PreferenceFieldOptions { lang: crate::i18n::Lang::EN, system: None, models: &json!({"available":false}), search: "" }, - ) - }, - values, - ); + let mut h = Harness::builder() + .with_size(vec2(680.0, 350.0)) + .build_ui_state(|ui, values| section_fields(ui, "performance", values, &["memoryUsageMb".into()], crate::i18n::Lang::EN, None, ""), values); h.run_steps(2); h.get_by_label("Memory Usage"); h.get_by_label("Per-document RAM limit (MB)"); @@ -2982,49 +2868,10 @@ mod tests { assert!(contains("placeholder", "type")); assert!(contains("performance", "performance")); assert!(contains("interface.uiScale", "interface")); - // The model choices exist only in builds that can run local models. - assert_eq!(contains("BACKGROUND REMOVAL", "integrations"), prefs::NATIVE_MODELS); - assert_eq!(contains("Object selection", "integrations"), prefs::NATIVE_MODELS); - assert_eq!(contains("integrations.subjectModel", "integrations"), prefs::NATIVE_MODELS); assert!(preference_sections(&values, "this setting does not exist").is_empty()); assert_eq!(preference_sections(&values, "").len(), SECTIONS.len()); } - #[test] - fn searched_model_preferences_render_only_the_matching_method_without_changing_choices() { - use egui_kittest::{Harness, kittest::Queryable}; - if !prefs::NATIVE_MODELS { - return; // Hidden without local models (unimplemented_preferences_are_hidden_from_the_dialog). - } - for code in ["en", "el"] { - let lang = crate::i18n::Lang::from_pref(code); - let _scope = crate::i18n::language_scope(lang); - for (visible, hidden) in [("Subject / background removal", "Object selection"), ("Object selection", "Subject / background removal")] { - let query = crate::i18n::tr(lang, visible); - let values = prefs::Preferences::default().to_json(); - assert!(preference_sections(&values, query).iter().any(|(id, _)| *id == "integrations")); - let obj = values["integrations"].as_object().unwrap().clone(); - let mut h = Harness::new_ui_state( - |ui, obj: &mut Map| { - section_fields( - ui, - "integrations", - obj, - &[], - PreferenceFieldOptions { lang, system: None, models: &json!({"available":false}), search: query }, - ); - }, - obj, - ); - h.run_steps(4); - assert!(h.query_by_label(crate::i18n::tr(lang, visible)).is_some(), "{code}: matching method is visible"); - assert!(h.query_by_label(crate::i18n::tr(lang, hidden)).is_none(), "{code}: unrelated method is filtered"); - assert_eq!(h.state()["subjectModel"], "classical"); - assert_eq!(h.state()["objectModel"], "classical"); - } - } - } - #[test] fn preferences_dialog_width_follows_its_resizable_area() { let prefs = serde_json::json!({"__prefsui": "prefs"}); @@ -3037,49 +2884,6 @@ mod tests { assert_eq!(super::width(shortcuts.as_object().unwrap(), 3000.0), Some(720.0)); } - #[test] - fn local_model_labels_cover_every_complete_language() { - let labels = [ - "Subject / background removal", - "Object selection", - "Classical (built in)", - "BiRefNet HR Matting", - "SAM 2.1 Large", - "Download", - "Download a model before choosing it. Downloads do not change the current method.", - "Downloaded", - "In use…", - "Large models can take time and use several GB of memory. Progress and Cancel appear in the status bar.", - "Local models aren't available in this build or session.", - "Local selection models", - "Model details", - "Models run on this device. Images stay on this device.", - "Not downloaded", - "Remove download", - "Select Subject and Remove Background; detailed, soft edges", - "Object Selection; drag a box around the object", - ]; - for info in &crate::i18n::LANGUAGES { - if !info.complete_menus { - continue; - } - let lang = crate::i18n::Lang::from_pref(info.code); - let missing: Vec<_> = labels.iter().filter(|label| !crate::i18n::has(lang, label)).collect(); - assert!(missing.is_empty(), "{}: missing model labels: {missing:?}", info.code); - } - } - - #[test] - fn local_model_choices_need_a_backend_and_a_download() { - assert!(model_choice_available(&json!({"available":false}), "classical")); - assert!(!model_choice_available(&json!({"available":false}), "sam2.1-large")); - let mut status = json!({"available":true,"models":[{"id":"sam2.1-large","installed":false}]}); - assert!(!model_choice_available(&status, "sam2.1-large")); - status["models"][0]["installed"] = json!(true); - assert!(model_choice_available(&status, "sam2.1-large")); - assert!(!model_choice_available(&status, "birefnet-hr-matting")); - } - #[test] fn preferences_settings_fill_the_dialog_down_to_the_buttons() { // The settings area plus the button row (spacing, 8 pt gap, buttons) stays inside what the @@ -4427,18 +4231,9 @@ mod tests { assert_eq!(labels, ["Use system setting", "On", "Off"]); assert_eq!(pref_choice_label("general.colorPicker", "system"), "System", "elsewhere `system` keeps its plain label"); let obj = json!({"animationEffects": "system"}).as_object().unwrap().clone(); - let mut h = Harness::builder().with_size(egui::vec2(700.0, 700.0)).build_ui_state( - |ui, obj: &mut Map| { - section_fields( - ui, - "interface", - obj, - &[], - PreferenceFieldOptions { lang: crate::i18n::Lang::from_pref("en"), system: None, models: &json!({"available":false}), search: "" }, - ) - }, - obj, - ); + let mut h = Harness::builder() + .with_size(egui::vec2(700.0, 700.0)) + .build_ui_state(|ui, obj: &mut Map| section_fields(ui, "interface", obj, &[], crate::i18n::Lang::from_pref("en"), None, ""), obj); h.run_steps(4); assert!(h.get_by_label("Animation effects").rect().is_positive()); h.get_all_by_role(Role::ComboBox).last().unwrap().click(); @@ -4462,9 +4257,6 @@ mod tests { assert!(has_visible_fields(&values, "integrations")); assert!(!prefs::is_hidden("integrations.allowAgentControl")); assert!(!prefs::is_hidden("integrations.controlPort")); - // Model choices only where models can run. - assert_eq!(!prefs::is_hidden("integrations.subjectModel"), prefs::NATIVE_MODELS); - assert_eq!(!prefs::is_hidden("integrations.objectModel"), prefs::NATIVE_MODELS); // "Fill new type layers with placeholder text" and "Use Escape to Commit" are live; other Type rows stay hidden. assert!(has_visible_fields(&values, "type")); assert!(!prefs::is_hidden("type.fillNewTypeLayersWithPlaceholder")); @@ -4694,15 +4486,7 @@ mod tests { use egui_kittest::{Harness, kittest::Queryable}; let obj = json!({"renderingMode": "auto", "historyStates": 50}).as_object().unwrap().clone(); let mut h = Harness::new_ui_state( - |ui, obj: &mut Map| { - section_fields( - ui, - "performance", - obj, - &[], - PreferenceFieldOptions { lang: crate::i18n::Lang::from_pref("en"), system: None, models: &json!({"available":false}), search: "" }, - ) - }, + |ui, obj: &mut Map| section_fields(ui, "performance", obj, &[], crate::i18n::Lang::from_pref("en"), None, ""), obj, ); h.run_steps(4); @@ -4711,15 +4495,7 @@ mod tests { // A search that leaves Rendering Mode out leaves its notice out too. let obj = json!({"renderingMode": "auto", "historyStates": 50}).as_object().unwrap().clone(); let mut h = Harness::new_ui_state( - |ui, obj: &mut Map| { - section_fields( - ui, - "performance", - obj, - &[], - PreferenceFieldOptions { lang: crate::i18n::Lang::from_pref("en"), system: None, models: &json!({"available":false}), search: "history" }, - ) - }, + |ui, obj: &mut Map| section_fields(ui, "performance", obj, &[], crate::i18n::Lang::from_pref("en"), None, "history"), obj, ); h.run_steps(4); @@ -4732,15 +4508,7 @@ mod tests { use egui_kittest::{Harness, kittest::Queryable}; let obj = json!({"allowAgentControl": true, "controlPort": 0}).as_object().unwrap().clone(); let mut h = Harness::new_ui_state( - |ui, obj: &mut Map| { - section_fields( - ui, - "integrations", - obj, - &[], - PreferenceFieldOptions { lang: crate::i18n::Lang::from_pref("en"), system: None, models: &json!({"available":false}), search: "" }, - ) - }, + |ui, obj: &mut Map| section_fields(ui, "integrations", obj, &[], crate::i18n::Lang::from_pref("en"), None, ""), obj, ); h.run_steps(4); @@ -4753,15 +4521,7 @@ mod tests { use egui_kittest::{Harness, kittest::Queryable}; let obj = json!({"showTooltips": true}).as_object().unwrap().clone(); let mut h = Harness::new_ui_state( - |ui, obj: &mut Map| { - section_fields( - ui, - "interface", - obj, - &[], - PreferenceFieldOptions { lang: crate::i18n::Lang::from_pref("en"), system: None, models: &json!({"available":false}), search: "" }, - ) - }, + |ui, obj: &mut Map| section_fields(ui, "interface", obj, &[], crate::i18n::Lang::from_pref("en"), None, ""), obj, ); h.run_steps(4); diff --git a/docs/architecture.md b/docs/architecture.md index f7b3bd4f96..0125f26693 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -22,9 +22,7 @@ What exists on `main` today. The numbered sections below are the original design - **Files:** own PSD/PSB crate (`psd`), flat codecs (`codecs`), camera raw (`raw`), HEIF (`heif`), Affinity (`affinity`), document mapping (`io`), native `.pcraft` (`format`, atomic saves). Coverage: [`file-format-parity.md`](file-format-parity.md). -- **ML:** the off-by-default `local-ml` feature provides native CPU BiRefNet matting and SAM - box selection; see [local models](local-models.md) and gap G15 for its downloads and limits. -- **Not built (yet) from the plan:** web ML, depth and sky models, plug-in ABI v2. +- **Not built (yet) from the plan:** the `ml` crate (no ML runtime; see gap G15), plug-in ABI v2. - **Deviations from the plan below:** `photocraft-tablet` is the one crate allowed `unsafe` (AppKit pen events); `affinity`, `heif` and `raw` crates were added; the phased roadmap in §15 is superseded by [`roadmap.md`](roadmap.md). @@ -157,7 +155,7 @@ photocraft/ └─ plan/ this directory ``` -**What exists today.** This layout is the target design. Built so far: `geom`, `cms`, `color`, `raster`, `psd`, `codecs`, `doc`, `ops`, `algo`, `paint`, `text`, `vector`, `compose`, `gpu`, `format`, `raw`, `io`, `plugins`, `ml`, `engine`, `ui-egui`, `automation`, `testkit`, and the three apps. `ml` supplies the optional native CPU backend for BiRefNet matting and SAM 2.1 box selection; [local models](local-models.md) documents its downloads and limits. Not yet split out: `viewport` and `tools` live inside `ui-egui` and `engine`; `platform` services are function hooks injected by each app (`ui_egui::Services`); `adobe-assets` is not started. Web ML, depth and sky models remain planned. +**What exists today.** This layout is the target design. Built so far: `geom`, `cms`, `color`, `raster`, `psd`, `codecs`, `doc`, `ops`, `algo`, `paint`, `text`, `vector`, `compose`, `gpu`, `format`, `raw`, `io`, `plugins`, `engine`, `ui-egui`, `automation`, `testkit`, and the three apps. Not yet split out: `viewport` and `tools` live inside `ui-egui` and `engine`; `platform` services are function hooks injected by each app (`ui_egui::Services`); `adobe-assets` and `ml` are not started. **Crate granularity:** start with the crates above. Split `algo` into `-adjust`, `-filters`, `-select`, `-inpaint` and `-warp` once any module passes about 10k lines, or once compile times hurt. Its internal module boundaries should already follow those lines. diff --git a/docs/development.md b/docs/development.md index 365294630a..4cb7161ab0 100644 --- a/docs/development.md +++ b/docs/development.md @@ -49,22 +49,6 @@ cargo xtask parity # Photoshop menu cove Image code is slow at `opt-level 0`, so the workspace profile builds dependencies at `opt-level 2`. Use `--release` for anything interactive. Test builds compile ui-egui itself at `opt-level 0` (`[profile.test.package.photocraft-ui-egui]` in `Cargo.toml`): it was one of the biggest test-build units, and its tests run no heavy pixel code of their own. -Optional CPU models for Object Selection, Select Subject and Remove Background are enabled with -`--features local-ml`. Weights remain separate, explicit downloads. See [local models](local-models.md) -for Preferences, CLI, provenance and native runtime packaging details. - -The native `local-ml` feature also enables `ort`'s `download-binaries` feature. Its pinned -ONNX Runtime 1.28 redistribution is fetched at **build time**, separately from Cargo crates -and the optional learned weights. A fresh `local-ml` build therefore requires network access -and is **not reproducible offline from Cargo.lock alone**. `cargo --offline` controls Cargo -resolution; it does not supply that runtime archive. Default builds and wasm omit this -dependency. Enabled distributors must ship the runtime licence and third-party notices; -see [native runtime packaging](local-models.md#build-and-use). On Windows that prebuilt runtime -needs a recent MSVC toolset: with MSVC 14.42 (Visual Studio 2022 17.12) the link fails with -unresolved `__std_search_1`, `__std_remove_1` and similar; update the Visual Studio Build Tools. -On Linux it needs glibc 2.38 and GCC 13's libstdc++ or newer (Ubuntu 24.04, not 22.04): older -systems fail with unresolved `__isoc23_strtol` and `_M_replace_cold`. - The dev profile builds PhotoCraft's crates with `debug = "line-tables-only"` and dependencies with no debug info: panic backtraces keep file and line in PhotoCraft code, and test binaries link about twice as fast. To inspect local variables in a debugger, build with `CARGO_PROFILE_DEV_DEBUG=true`. ### Faster test loops diff --git a/docs/gaps.md b/docs/gaps.md index da8841653a..da546b75e3 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -193,16 +193,12 @@ what an agent can't finish alone. ### G15. AI and generative features - **Missing:** Generative Fill and Expand, Generative Upscale, Neural Filters, Sky Replacement, - Super Zoom and ML Select Sky. The off-by-default `local-ml` backend supplies optional - BiRefNet subject matting/removal and SAM box selection (AUTO-219-7 remains partial). - Its 20-target COCO pilot is exploratory, not representative alpha-matting quality; - web inference and accelerated providers remain open. Classical substitutes exist - (GrabCut/max-flow selection, Remove tool by non-local patch completion). + Super Zoom, ML Select Subject/Sky. There is no ML runtime (AUTO-219-7). Classical substitutes + exist (GrabCut/max-flow selection, Remove tool by non-local patch completion). - **Evidence:** Photoshop's `Required/UXP` ships the Neural Filters gallery and its `.kys` has a Neural Filters taskspace; users ask for local models (#2313, #1996, #2682). - **Progress (2026-10-17):** classical Object Finder no longer rejects a foreground solely for covering over 60% of the canvas (#6548); canvas-boundary coverage distinguishes it from the surrounding backdrop. This does not add semantic recognition or close #2788. - **Estimate:** 300–600 h. **Human:** owner decision #41 (model licences, local vs remote). -- **2026-10-10 evidence:** [optional models](local-models.md), [pilot and limitations](local-models-validation.md); no new accuracy measurement from the rebase. ### G16. Plug-in compatibility - **Missing:** hosting Photoshop .8BF filters (#2647), UXP panels, CEP. PhotoCraft has its own @@ -408,7 +404,6 @@ what an agent can't finish alone. | 2026-10-14 | minor | G1: Lab adjustment layers' results are whole samples (native Lab path); photoshop lab8 curves passes | | 2026-10-21 | minor | G8: Photoshop's type on a path opens on its path (read from the `Txt2` frame) and saves back into the file's `Txt2` object (#7962); TYPE-218-1 stays partial (new documents save path text as point text) | | 2026-10-19 | minor | G9: Color panel modes, ramp and copy commands from its panel menu, the same in every theme (UI-217-17 done, #6000) | -| 2026-10-10 | minor | G15 records optional local selection models and the exploratory pilot; generative provider work remains open | | 2026-10-15 | minor | G1 / #5972 A1: render only provably constant-RGB `GdFl` noise fills; variable noise synthesis remains open | | 2026-10-20 | minor | G10: `.asl` layer style library import and export landed (#1051) | | 2026-10-18 | minor | G9: with no selection, Copy takes fill and adjustment layers whole and Paste recreates them (#2344); UI-217-23 stays partial (a single pixel layer copies its pixels only); estimate unchanged | diff --git a/docs/images/LICENSE-local-models.txt b/docs/images/LICENSE-local-models.txt deleted file mode 100644 index 4936621edd..0000000000 --- a/docs/images/LICENSE-local-models.txt +++ /dev/null @@ -1,10 +0,0 @@ -local-models-before.png and local-models-preferences.png are original PhotoCraft UI screenshots -and are licensed under this repository's MIT OR Apache-2.0 terms (LICENSE-MIT / LICENSE-APACHE). - -local-models-comparison.png uses Johannes Vermeer's Girl with a Pearl Earring, c. 1665. -The original artwork and its faithful photographic reproduction are public domain (PD-Art). -Source: https://commons.wikimedia.org/wiki/File:1665_Girl_with_a_Pearl_Earring.jpg -The comparison layout and command output presentation are original PhotoCraft contributions, -licensed under this repository's MIT OR Apache-2.0 terms. - -No learned model weights or personal photographs are included in these documentation assets. diff --git a/docs/images/SOURCES.md b/docs/images/SOURCES.md index f10de6a05a..1d68651a57 100644 --- a/docs/images/SOURCES.md +++ b/docs/images/SOURCES.md @@ -11,8 +11,6 @@ | `photocraft-transform.jpg` | PhotoCraft UI screenshot (offscreen snapshot) with *The Tetons and the Snake River*, Ansel Adams, 1942 (U.S. National Archives) | Artwork: public domain, [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Adams_The_Tetons_and_the_Snake_River.jpg). UI: this project. | | `photocraft-type.jpg` | PhotoCraft UI screenshot (offscreen snapshot) with *Among the Sierra Nevada, California*, Albert Bierstadt, 1868 | Artwork: public domain, [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Albert_Bierstadt_-_Among_the_Sierra_Nevada,_California_-_Google_Art_Project.jpg). UI: this project. | | `photocraft-export-light.jpg` | PhotoCraft UI screenshot (offscreen snapshot) with *The Kiss*, Gustav Klimt, 1907–1908 | Artwork: public domain, [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Gustav_Klimt_016.jpg). UI: this project. | -| `local-models-before.png`, `local-models-preferences.png` | PhotoCraft Preferences, offscreen snapshots before / after optional local models | Original project UI, MIT OR Apache-2.0; [licence](LICENSE-local-models.txt). | -| `local-models-comparison.png` | Actual exported classical / BiRefNet / SAM masks over a checkerboard, using *Girl with a Pearl Earring*, Johannes Vermeer, c. 1665 | Artwork: public domain, [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:1665_Girl_with_a_Pearl_Earring.jpg); original layout: MIT OR Apache-2.0; [licence](LICENSE-local-models.txt). | Screenshots must use famous public-domain artwork (or content made in the app), never personal photos. diff --git a/docs/images/local-models-before.png b/docs/images/local-models-before.png deleted file mode 100644 index 90442321a1..0000000000 Binary files a/docs/images/local-models-before.png and /dev/null differ diff --git a/docs/images/local-models-comparison.png b/docs/images/local-models-comparison.png deleted file mode 100644 index 851ba24f1f..0000000000 Binary files a/docs/images/local-models-comparison.png and /dev/null differ diff --git a/docs/images/local-models-preferences.png b/docs/images/local-models-preferences.png deleted file mode 100644 index a3c5e46ccd..0000000000 Binary files a/docs/images/local-models-preferences.png and /dev/null differ diff --git a/docs/local-models-validation.md b/docs/local-models-validation.md deleted file mode 100644 index 427518200b..0000000000 --- a/docs/local-models-validation.md +++ /dev/null @@ -1,185 +0,0 @@ -# Optional local models: validation - -Recorded 2026-10-08 on an Apple M3 Max with 36 GiB RAM, Rust 1.98.0, native CPU inference -and the immutable model exports listed in [local-models.md](local-models.md). No learned weights -are included in this repository. The integration/performance checks below are supplemented by a -fixed 22-case evaluation. Its 20 labelled COCO targets are exploratory evidence, not a representative -or held-out benchmark, a soft-alpha matting assessment, or evidence of a universal winner. - -## CI follow-up: 2026-10-11 - -Integrated upstream `6ff2a03f33dbe84e726e9cc0c31787de8f91f50b`, including its -platform-independent save-dialog regression fix. The batch merge keeps upstream's called-action -state and nested-error handling alongside the explicit model backend, authorization and method -preferences. The extended batch regression verifies model inference inside a called action and -rejects the same call when the host has not granted a backend. - -Full native suites with the optional backend and HEIF passed on macOS: 1,179 engine / 1,733 UI / -52 automation / 12 ML unit tests, plus CLI and integration tests (11 / 10 / 0 / 1 ignored). -The extended batch regression also passed. Final lint/platform results are linked from the PR; -this follow-up does not rerun or change the historical accuracy/performance evaluation. - -## Review update: 2026-10-10 - -Rebased on upstream 0.6.0 (`ab76c242a1225efc680dc88bd761cc202e1e29df`). The optional model -workflow is manual-only (`workflow_dispatch`), with no push/PR triggers. The development guide -now identifies the ONNX Runtime build-time download and offline limitation. The -[export review rationale](local-models.md#why-these-community-exports) links exact official -checkpoint trees and community metadata, explains why ONNX re-exports remain selected, and -separates artifact identity from independently proven conversion equivalence. - -All 18 model labels now cover Dutch and Ukrainian and the other 14 complete catalogs, guarded -by a runtime lookup regression. Existing catalog entries and all other contributors' credits -are preserved. New entries are kept away from append locations to reduce future conflicts. -The lockfile preserves all 728 existing upstream package versions; it adds only the optional -backend entries. Model revisions/bytes and the historical benchmark remain unchanged. - -Fresh optional-native tests, lint, default builds, dependency layers, parity, scorecard, -adversarial command tests and wasm checks are linked from [#1199](https://github.com/storytold/photocraft/pull/1199). -Native engine tests passed 1,169 / 11 ignored; the final UI suite after the file-dialog update -passed 1,721 / 10 ignored, with all integration tests green. Five-package all-target Clippy -(`local-ml,heif`), the default build, layers, parity (628/628), scorecard, optional-feature -adversarial commands, full L0–L6 wasm and optional engine/UI wasm all pass. Ignored tests -are not counted as passes. An offscreen 1200×800 Preferences › Integrations capture was -inspected: both explicit downloads are offered while both selected methods remain Classical. -Historical screenshots below are not current 0.6.0 captures. - -## Upstream integration check: 2026-10-09 - -Integrated upstream `2515fa7cee624cf232c873ba283aa0359ec159d7`. The integration keeps the -upstream Rotate View preference, Linux display-server selection and Wayland snapshot behavior alongside the optional -model controls. It adds model labels to the newly supported Greek catalog and keeps every -upstream translation and contributor entry. Additive catalog/self-credit blocks are placed -before existing entries to reduce conflicts with future upstream additions. - -The native optional-backend suites passed on macOS: engine unit tests **945 passed / 11 ignored**, -UI unit tests **1,112 passed / 7 ignored**, plus ML runtime and CLI integration tests. Five-package -all-target Clippy with warnings denied, the default native build, layers, 627/627 parity, -regenerated scorecard, optional-backend adversarial panic hunt, full L0–L6 wasm and optional -engine/UI wasm checks passed. Ignored tests are not counted as passes. The native matrix now -also runs model Preferences and complete-language catalog tests; its current run is linked from -[#1199](https://github.com/storytold/photocraft/pull/1199). - -The real-image measurements and screenshots below remain the earlier evidence at their stated -commits; rebasing does not turn them into a new accuracy or performance benchmark. - -## Preferences before and after - -Before, from the unmodified `5896f0b` source: - -![Preferences before](images/local-models-before.png) - -After, with both models explicitly downloaded into an isolated development cache. The two -methods still default to Classical. Downloads/removals use the engine's existing progress and -cancellation jobs; Apply/OK saves the method choices. - -![Preferences after](images/local-models-preferences.png) - -## Real model outputs and timings - -The comparison uses Vermeer's public-domain *Girl with a Pearl Earring*. The 960 × 1137 source -was resized to 4500 × 5333 (23,998,500 pixels) to exercise the required 24 MP processing path; -upsampling does not add detail or make it an accuracy dataset. Each command ran twice in the -same session, with Undo restoring the input between runs. Timings include preparation, hash -verification, model loading on the first run, inference and document apply, excluding PNG export. - -| Command / method | First run | Second run | -|---|---:|---:| -| Remove Background / Classical | 318 ms | 306 ms | -| Remove Background / BiRefNet HR Matting | 35,275 ms | 28,790 ms | -| Object Selection / Classical | 543 ms | 296 ms | -| Object Selection / SAM 2.1 Large | 7,112 ms | 5,555 ms | - -For Object Selection, the same rectangle starts at 10% of the width and 5% of the height and -covers 85% × 95% of the canvas. Selection was converted to a layer mask only for export. -The checkerboard is a presentation background under the actual exported alpha, not painted -into the masks. Left to right: original, classical removal, BiRefNet removal, classical object -selection, SAM object selection. - -![Actual command outputs](images/local-models-comparison.png) - -The classical method works well on this example. BiRefNet supplies continuous edge alpha; -SAM leaves some unwanted holes. These results support keeping both choices available. The -exploratory multi-image evaluation below also includes failures and cases where Classical is better. - -Repeated BiRefNet runs initially exhausted memory with ONNX Runtime's default CPU arena and -memory-pattern caching. Disabling both while retaining only the current model's weights let -all eight runs complete. Peak RSS was not measured; several GB of RAM are still required. - -Reproduce using verified, explicitly installed models and a public-domain 24–36 MP image: - -```sh -cargo run --release -p photocraft-engine --features local-ml --example local_models_bench -- \ - /absolute/model-cache /absolute/image.png /absolute/comparison-directory -``` - -## Fixed multi-image evaluation - -The [33-page comparison PDF and public reproducibility supplement](https://github.com/mighty-programmer/photocraft/releases/tag/model-evaluation-2026-10-08) -contain all 22 distinct cases: 20 COCO val2017 images with independent binary instance references, -plus two user-supplied LEGO photos for visual inspection. There are 44 paired comparisons, -88 final method outcomes and 86 actual exported cutouts. BiRefNet's no-subject chair result and -Classical's empty zebra object selection are explicit failures, counted as zero rather than omitted. - -| Feature | Classical mean target IoU | Learned mean target IoU | Learned wins / losses / near-ties | -|---|---:|---:|---:| -| Remove Background | 31.5% | 51.5% (BiRefNet HR Matting) | 15 / 2 / 3 | -| Box Object Selection | 52.5% | 79.1% (SAM 2.1 Large) | 16 / 3 / 1 | - -Cases were selected using a fixed hash seed before inference, one from each of 20 categories. -Alpha is thresholded at 128/255, and a win/loss requires over one percentage point of IoU change. -Object boxes are derived from the annotation with 10% padding and reused for both methods. -The two unlabelled LEGO photos are excluded from the means. Each background-removal reference -contains one instance; keeping other plausible foreground subjects counts as a false positive. -COCO polygons cannot establish hair, soft-alpha or transparent-glass matting quality. This selected -pilot may overlap training data, and its annotation-derived boxes are easier than imperfect user boxes. - -Median warm command times on the M3 Max / 36 GiB were 0.19 / 26.63 seconds for Classical / -BiRefNet removal and 0.20 / 5.59 seconds for Classical / SAM selection. These single-pass observations -exclude image import/export and initial/model-loading cases; they are not Windows/Linux timings. -Storage pressure interrupted two exports, which were rerun; the supplement preserves all 90 raw -attempts, 88 final outcomes and the recovery notes. Sampled resumed-run peak RSS was 13.35 GiB; -initial memory samples were not saved. - -All methods ran in the same release engine at benchmark commit -`6e2b7bc9b20938787cf1f7af9718a832a2edf716`. The Classical algorithm sources match stock 0.3.0 -`60224d3fb7d4006bcfcc97603c1611b9b756aebd`; the installed stock GUI was not timed separately. -Later UI/account changes were not re-benchmarked. The release tag identifies the tested engine, -and the supplement supplies the exact rectangles, annotation polygons/reference masks, source -hashes, command logs, CSV scores, model revisions and Rust harness. Its helper downloads and -hash-checks the 20 public inputs; model installation stays explicit. The report retains photo and -annotation attribution. Standalone user-photo originals, full-resolution cutouts and model weights -are not bundled in the public supplement or software repository. - -## Checks - -- ML unit tests execute both contracts through the actual CPU runtime using original tiny ONNX - graphs. Streaming tests cover truncation, corruption, overlong data and cancellation; lifecycle - tests cover scoped removal, busy state and dependency panic recovery. -- Engine tests cover RGB/Gray/CMYK/Lab at 8/16/32-bit, ICC input conversion, fractional alpha, - layer-mask replacement, selection modes and rectangle mapping, one-step Undo/Redo, cancellation, - missing-model errors, recorded method choices, batch/droplet capability inheritance and model - management while a selection floats. Non-finite/out-of-range alpha is sanitized for model input - while original 32-bit pixel values are preserved. -- Full engine, CLI and UI test suites pass locally. UI preference/localization coverage includes - every supported complete-menu language. Default and `local-ml` build paths retain classical - operation without installing models. -- The complete L0–L6 `xtask wasm` check and an additional optional-feature engine/UI wasm check - pass. ONNX Runtime remains outside the wasm dependency graph. Layers and generated parity / - scorecard checks pass; menu coverage remains 627/627. -- Clippy with all targets across the six touched packages and `local-ml` passes with warnings - denied. The ignored `panic_hunt` test passes with the optional feature enabled. -- The opt-in full-model CPU smoke test verifies the real files, then runs both actual model - pipelines. The repeated 24 MP release example above exports all four actual command results. -- `xtask perf --quick --bench perf_scenarios` passes for the existing selection/retouch scenarios; - it does not establish a sub-100 ms budget for the optional models. - -The dedicated `local-models.yml` workflow runs Linux, Windows and macOS CPU runtime tests and -native build checks. The [cross-platform run at `1904396`](https://github.com/mighty-programmer/photocraft/actions/runs/37849240044) -passes on all three platforms, including the final document-state and input regression tests. -The contribution is ready for review. Upstream PR CI needs maintainer approval for -this first contribution. Representative held-out/matting evaluation, packaged installer / sandbox -download checks, web inference, point prompts and GPU acceleration remain separate work. - -Image sources and licences: [SOURCES.md](images/SOURCES.md), -[LICENSE-local-models.txt](images/LICENSE-local-models.txt). diff --git a/docs/local-models.md b/docs/local-models.md deleted file mode 100644 index 9f4b442221..0000000000 --- a/docs/local-models.md +++ /dev/null @@ -1,178 +0,0 @@ -# Optional local selection models - -PhotoCraft keeps its classical Object Selection, Select Subject and Remove Background methods -as the defaults. A build with `local-ml` offers two separately downloadable alternatives for -cases where a larger learned model is useful. Images are processed on the device; downloading -weights is the only network operation. This first backend uses CPU inference on native desktops, -including Windows and Linux, without Python, CUDA or a GPU requirement. The web build retains -the classical methods. - -| Model | Use | Download | Training input | Licence | -|---|---|---:|---|---| -| BiRefNet HR Matting | Select Subject / Remove Background, preserving soft alpha | 932,150,975 bytes (889 MiB) | 2048 × 2048 RGB | MIT | -| SAM 2.1 Large | Object Selection with a dragged rectangle | 911,109,265 bytes (869 MiB) | 1024 × 1024 RGB | Apache-2.0 | - -These FP32 models can take tens of seconds and use several GB of RAM. They are optional methods, -not a guarantee of better results on every image. SAM is an object segmentation model, not a -hair/transparency matting model. BiRefNet may pick several foreground objects. Difficult edges -can still need Select and Mask or manual mask edits. HDR values are converted and clipped for -the model input; original pixels remain unchanged. Canvases are currently limited to 64 MP for -model commands, and output coverage uses PhotoCraft's existing 8-bit selection/mask format. - -## Build and use - -```sh -cargo run --release -p photocraft --features local-ml -- photo.png -``` - -1. Open Edit › Preferences › Integrations. -2. Download either model. Progress and Cancel use the existing status bar. Each download is - independent and does not select a method automatically. -3. Choose a downloaded model for **Object selection** or **Subject / background removal**, then - Apply or OK. These preferences are independent; Classical remains available. -4. Drag an Object Selection rectangle, use Select › Subject, or use the existing **Remove - Background** Quick Action in the layer Properties panel. - -Remove Background replaces the layer's mask, converts a Background to a normal layer when -needed, and clears the selection in one undo step. Source pixels are preserved. Its `refine` -option affects the classical method only: applying classical refinement to BiRefNet's alpha -would change the matte. Existing layer/parent locks still apply. Selection commands retain -replace/add/subtract/intersect and active-layer/composite sampling. - -Object Finder hover previews and point clicks use the built-in classical method, including -when SAM is selected for boxes. Recorded point actions store Classical. An explicit SAM -request with a point is rejected: this model export supports rectangle prompts only. -The classical Select Subject result cache remains available independently of model inference. - -Missing or corrupt weights produce an actionable error; inference never downloads or silently -changes methods. **Remove download** removes only the selected model and returns its preference -to Classical. A cancelled job never applies its document result. Cancellation during model -loading is checked after session creation; network cleanup may wait for a stalled read timeout. - -The desktop cache is `Models/` under the existing per-user configuration directory (including -`PHOTOCRAFT_CONFIG_DIR` or portable `PhotoCraftData`). It is separate from image files and -preferences. Each immutable model revision gets its own directory with `LICENSE.txt` and -`SOURCE.txt`; inference verifies the hashes again, including SAM's external weights. - -Linux uses the existing XDG configuration path, so an AppImage stores models outside its -read-only mounted image and a Flatpak uses its sandbox's XDG configuration directory. The current -Flatpak manifests omit network permission and do not enable `local-ml`. A distributor opting in -must also choose how explicit downloads receive network access (or prepopulate a verified cache); -this backend does not alter sandbox permissions. Windows uses `%APPDATA%\\Photocraft\\Models` -outside portable/override mode. Installer packaging and sandbox download checks remain separate -from the native CPU build matrix. - -## Commands and CLI - -| Command | Parameters | -|---|---| -| `models.list` | `{}`; returns availability, installed/busy state, sizes, licences and provenance | -| `models.download` | `{"id":"birefnet-hr-matting"}` or `{"id":"sam2.1-large"}` | -| `models.remove` | Same ids; no document required | -| `select.subject`, `layer.removeBackground` | `"model":"classical"` or `"birefnet-hr-matting"`; omitted uses Preferences | -| `select.object` | `"rect":[x,y,width,height]`, plus `"model":"classical"` or `"sam2.1-large"`; `"point":[x,y]` uses Classical Object Finder | - -Downloads/removals do not enter recorded actions or document history. Commands accept catalogue -ids, never arbitrary URLs or model paths. Recorded selection/removal actions store the chosen -method, so changing Preferences does not change playback. Batch and droplets reuse a configured -backend across inputs. Automation hosts must explicitly inject a backend -capability; an untrusted headless MCP session does not gain cache/network authority by enabling -the feature. The trusted CLI accepts an explicit `PHOTOCRAFT_MODEL_DIR`: - -```sh -# Build once. No model weights are downloaded at build time. -cargo build --release -p photocraft-cli --features local-ml -export PHOTOCRAFT_MODEL_DIR="/absolute/path/to/model-cache" - -# Explicit installation, without an input photo (the empty document is only CLI run context). -target/release/photocraft-cli run --new '{"width":1,"height":1}' \ - --cmd models.download --params '{"id":"birefnet-hr-matting"}' - -target/release/photocraft-cli run photo.png \ - --cmd layer.removeBackground --params '{"model":"birefnet-hr-matting"}' \ - --out cutout.png - -target/release/photocraft-cli run photo.png \ - --cmd select.object --params '{"rect":[40,20,500,700],"model":"sam2.1-large"}' \ - --out selected.pcraft -``` - -PowerShell: set `$env:PHOTOCRAFT_MODEL_DIR = 'C:\\path\\to\\model-cache'` and use the `.exe` binary. -Distributors opt in with `local-ml`; existing/default installers do not acquire the feature from -downloading these weights. `ort = 2.0.0-rc.13` downloads its pinned ONNX Runtime 1.28 redistribution -at **build** time. Ship that runtime's MIT licence and third-party notices with enabled builds; -the copies in `crates/ml/licenses/` document this obligation. Release packaging is a distributor -decision, and this change does not enable the feature in official release workflows. - -## Provenance and review - -### Why these community exports - -Source review on 2026-10-10 found no ONNX files in the exact official checkpoint trees: -[BiRefNet HR Matting at `5d6b6f8`](https://huggingface.co/ZhengPeng7/BiRefNet_HR-matting/tree/5d6b6f8adcb5b417c871b1d84ceaae9871355b7f) -publishes Safetensors; [Meta SAM 2.1 Large at `665f8e2`](https://huggingface.co/facebook/sam2.1-hiera-large/tree/665f8e2ad61cf5f53d65644ff27c8ee525124610) -publishes Safetensors and a PyTorch checkpoint. This Rust backend needs ONNX graphs, so it -retains the already evaluated FP32 exports below rather than introducing Python/PyTorch or -changing the benchmarked model variant. No Hugging Face Python or `trust_remote_code` runs. - -The [pinned PinkPixel card](https://huggingface.co/PinkPixel/birefnet-hr-matting-onnx/blob/792518b9d4dfe9793891712677de25e554f948c6/README.md) -identifies the original BiRefNet checkpoint and documents its 2048-pixel input/alpha contract. -The [pinned onnx-community configuration](https://huggingface.co/onnx-community/sam2.1-hiera-large-ONNX/blob/3c23431f721e69cae82dbfd0c28fd692cc714021/config.json) -specifies FP32 SAM 2 at 1024 pixels; that revision has no model card or conversion recipe. -Our review therefore relies on graph/IO inspection, actual CPU execution of both downloaded -models and the published 22-case output evidence, with failures retained. It does not claim -independent verification of the conversion's equivalence to Meta's checkpoint. - -Every selected artifact's LFS byte count and SHA-256 was rechecked against its immutable -export revision on 2026-10-10 and still matches the catalog. Exact pins, streaming integrity -checks, explicit opt-in, original-model licences and evaluated outputs make these -community artifacts reviewable; hashes establish identity, not training provenance or -upstream endorsement. A compatible author-published ONNX export can replace one through a -future reviewed catalog/adapter update and new output comparisons. - - -All URLs, exact byte counts and SHA-256 hashes are in -[`crates/ml/src/catalog.rs`](../crates/ml/src/catalog.rs), derived from the pinned exports' Hugging -Face LFS metadata. A model update requires a code change and review; there is no mutable remote -manifest. Original checkpoint licences apply to their converted weights: - -| Model | Original checkpoint / code | Reviewed ONNX export and immutable revision | -|---|---|---| -| BiRefNet | [ZhengPeng7/BiRefNet_HR-matting](https://huggingface.co/ZhengPeng7/BiRefNet_HR-matting), [BiRefNet](https://github.com/ZhengPeng7/BiRefNet) | [PinkPixel/birefnet-hr-matting-onnx](https://huggingface.co/PinkPixel/birefnet-hr-matting-onnx/tree/792518b9d4dfe9793891712677de25e554f948c6) | -| SAM 2.1 Large | [facebook/sam2.1-hiera-large](https://huggingface.co/facebook/sam2.1-hiera-large), [facebookresearch/sam2](https://github.com/facebookresearch/sam2) | [onnx-community/sam2.1-hiera-large-ONNX](https://huggingface.co/onnx-community/sam2.1-hiera-large-ONNX/tree/3c23431f721e69cae82dbfd0c28fd692cc714021) | - -The BiRefNet export has `image` input and `alpha` output with sigmoid already included. SAM uses -three image embeddings, an ignored padding point with int64 label `-1`, and normalized box -corners scaled to 1024. It returns three logits masks and predicted IoU scores. These contracts -are tested through the real runtime with small original synthetic graphs, and the downloaded -graphs are inspected/run separately. Community exports should remain part of upstream review: -file hashes establish identity, not an independent audit of model training or conversion. - -```sh -cargo test -p photocraft-ml --features onnx -cargo test -p photocraft-engine -p photocraft-cli --features local-ml -cargo clippy -p photocraft-ml -p photocraft-engine --features photocraft-ml/onnx,local-ml --all-targets -- -D warnings -``` - -`.github/workflows/local-models.yml` is **manual-only** (`workflow_dispatch`): no push or -pull-request trigger. An explicit run exercises CPU runtime contracts, commands, Preferences, -catalogs and native build paths on Windows, Linux and macOS without downloading learned weights. The opt-in full-model -smoke test is separate; the download flag is explicit and transfers about 1.8 GB: - -```sh -PHOTOCRAFT_MODEL_TEST_DIR=/absolute/path/to/test-cache \ -PHOTOCRAFT_MODEL_TEST_DOWNLOAD=1 \ - cargo test -p photocraft-ml --features onnx real_models_cpu_smoke -- --ignored --nocapture -``` - -Omit `PHOTOCRAFT_MODEL_TEST_DOWNLOAD` to test existing verified files offline. The -[22-case PDF and public supplement](https://github.com/mighty-programmer/photocraft/releases/tag/model-evaluation-2026-10-08) -include an exploratory comparison on 20 fixed COCO polygon targets plus two visual-only photos. -The protocol, model failures, measured scores and reproducible harness are documented in -[local-models-validation.md](local-models-validation.md). These binary instance references do not -establish labelled hair/soft-alpha/transparency matting quality. Representative quality evaluation -and web inference remain open, so the smart-features scorecard stays partial. - -See [validation and comparison](local-models-validation.md) for the measured 24 MP timings, -before/after Preferences screenshots, actual exported masks, completed three-platform native -CI and outstanding packaged-installer/production checks. diff --git a/scorecard/automation.toml b/scorecard/automation.toml index fd573a0839..862de726f2 100644 --- a/scorecard/automation.toml +++ b/scorecard/automation.toml @@ -56,9 +56,9 @@ note = "runtime.rs:15 ABI_VERSION = 1; manifest.rs:18 Kind::Filter only" [[item]] id = "AUTO-219-7" target = "Local ONNX models behind a flag, managed in Preferences; subject select, background removal" -status = "partial" +status = "missing" issue = 219 -note = "local-ml: CPU BiRefNet alpha / SAM 2.1 box selection, pinned verified explicit downloads in Preferences; exploratory 20-target COCO comparison in docs/local-models-validation.md; representative matting quality and web inference remain open" +note = "No ONNX runtime dependency" [[item]] id = "AUTO-219-8"