Skip to content

Commit

Permalink
chore: fix style + bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
load1n9 committed Jun 8, 2024
1 parent c9ec0e6 commit b0b6fb6
Show file tree
Hide file tree
Showing 15 changed files with 290 additions and 147 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
rustc --version
cargo --version
cargo build --release -p netsaur
deno run -Ar https://deno.land/x/wasmbuild@0.15.6/main.ts -p netsaur --out src/backends/wasm/lib
deno run -Ar https://deno.land/x/wasmbuild@0.15.6/main.ts -p netsaur-tokenizers --out tokenizers/lib
deno run -Ar jsr:@deno/wasmbuild@0.17.1 -p netsaur --out src/backends/wasm/lib
deno run -Ar jsr:@deno/wasmbuild@0.17.1 -p netsaur-tokenizers --out tokenizers/lib
- name: Release
uses: softprops/action-gh-release@master
env:
Expand Down
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ console.log(`1 xor 1 = ${out4[0]} (should be close to 0)`);
### Documentation

The full documentation for Netsaur can be found
[here](https://deno.land/x/netsaur@0.3.1/mod.ts).
[here](https://deno.land/x/netsaur@0.3.1-patch/mod.ts).

### License

Expand Down
2 changes: 1 addition & 1 deletion crates/core-gpu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "netsaur-gpu"
version = "0.3.1"
version = "0.3.1-patch"

[lib]
crate-type = ["cdylib"]
Expand Down
6 changes: 3 additions & 3 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "netsaur"
version = "0.3.1"
version = "0.3.1-patch"

[lib]
crate-type = ["cdylib"]
Expand All @@ -14,6 +14,6 @@ serde_json = "1.0"
safetensors = "0.4.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "=0.2.90"
wasm-bindgen = "0.2.92"
getrandom = { version = "0.2", features = ["js"] }
js-sys = "0.3.67"
js-sys = "0.3.69"
6 changes: 3 additions & 3 deletions crates/tokenizers/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "netsaur-tokenizers"
version = "0.3.1"
version = "0.3.1-patch"

[lib]
crate-type = ["cdylib"]
Expand All @@ -13,6 +13,6 @@ serde = {version = "1.0", features = ["derive"]}
serde_json = "1.0"
serde-wasm-bindgen = "0.6.0"
tokenizers = { version="0.14.1", default-features=false, features = ["unstable_wasm"]}
wasm-bindgen = "=0.2.90"
wasm-bindgen = "0.2.92"
getrandom = { version = "0.2", features = ["js"] }
js-sys = "0.3.67"
js-sys = "0.3.69"
6 changes: 3 additions & 3 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@denosaurs/netsaur",
"version": "0.3.2",
"version": "0.3.2-patch",
"exports": {
".": "./mod.ts",
"./tokenizers": "./tokenizers/mod.ts",
Expand Down Expand Up @@ -28,7 +28,7 @@
"build": "deno task build:cpu && deno task build:wasm && deno task build:tokenizers",
"build:cpu": "cargo build --release -p netsaur",
"build:gpu": "cargo build --release -p netsaur-gpu",
"build:wasm": "deno run -Ar https://deno.land/x/wasmbuild@0.15.6/main.ts -p netsaur --out src/backends/wasm/lib",
"build:tokenizers": "deno run -Ar https://deno.land/x/wasmbuild@0.15.6/main.ts -p netsaur-tokenizers --out tokenizers/lib"
"build:wasm": "deno run -Ar jsr:@deno/wasmbuild@0.17.1 -p netsaur --out src/backends/wasm/lib",
"build:tokenizers": "deno run -Ar jsr:@deno/wasmbuild@0.17.1 -p netsaur-tokenizers --out tokenizers/lib"
}
}
2 changes: 1 addition & 1 deletion examples/visualize.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
" setupBackend,\n",
" SigmoidLayer,\n",
" tensor2D,\n",
"} from \"https://deno.land/x/netsaur@0.3.1/mod.ts\";\n",
"} from \"https://deno.land/x/netsaur@0.3.1-patch/mod.ts\";\n",
"\n",
"await setupBackend(AUTO);\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion src/backends/cpu/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const options: FetchOptions = {
name: "netsaur",
url: new URL(import.meta.url).protocol !== "file:"
? new URL(
"https://github.com/denosaurs/netsaur/releases/download/0.3.2/",
"https://github.com/denosaurs/netsaur/releases/download/0.3.2-patch/",
import.meta.url,
)
: "./target/release/",
Expand Down
2 changes: 1 addition & 1 deletion src/backends/gpu/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const options: FetchOptions = {
name: "netsaur_gpu",
url: new URL(import.meta.url).protocol !== "file:"
? new URL(
"https://github.com/denosaurs/netsaur/releases/download/0.3.2/",
"https://github.com/denosaurs/netsaur/releases/download/0.3.2-patch/",
import.meta.url,
)
: "./target/release/",
Expand Down
65 changes: 65 additions & 0 deletions src/backends/wasm/lib/netsaur.generated.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// deno-lint-ignore-file
// deno-fmt-ignore-file

export interface InstantiateResult {
instance: WebAssembly.Instance;
exports: {
wasm_backend_create: typeof wasm_backend_create;
wasm_backend_train: typeof wasm_backend_train;
wasm_backend_predict: typeof wasm_backend_predict;
wasm_backend_save: typeof wasm_backend_save;
wasm_backend_load: typeof wasm_backend_load
};
}

/** Gets if the Wasm module has been instantiated. */
export function isInstantiated(): boolean;

/** Options for instantiating a Wasm instance. */
export interface InstantiateOptions {
/** Optional url to the Wasm file to instantiate. */
url?: URL;
/** Callback to decompress the raw Wasm file bytes before instantiating. */
decompress?: (bytes: Uint8Array) => Uint8Array;
}

/** Instantiates an instance of the Wasm module returning its functions.
* @remarks It is safe to call this multiple times and once successfully
* loaded it will always return a reference to the same object. */
export function instantiate(opts?: InstantiateOptions): Promise<InstantiateResult["exports"]>;

/** Instantiates an instance of the Wasm module along with its exports.
* @remarks It is safe to call this multiple times and once successfully
* loaded it will always return a reference to the same object. */
export function instantiateWithInstance(opts?: InstantiateOptions): Promise<InstantiateResult>;

/**
* @param {string} config
* @param {Array<any>} shape
* @returns {number}
*/
export function wasm_backend_create(config: string, shape: Array<any>): number;
/**
* @param {number} id
* @param {(Float32Array)[]} buffers
* @param {string} options
*/
export function wasm_backend_train(id: number, buffers: (Float32Array)[], options: string): void;
/**
* @param {number} id
* @param {Float32Array} buffer
* @param {string} options
* @returns {Float32Array}
*/
export function wasm_backend_predict(id: number, buffer: Float32Array, options: string): Float32Array;
/**
* @param {number} id
* @returns {Uint8Array}
*/
export function wasm_backend_save(id: number): Uint8Array;
/**
* @param {Uint8Array} buffer
* @param {Array<any>} shape
* @returns {number}
*/
export function wasm_backend_load(buffer: Uint8Array, shape: Array<any>): number;
Loading

0 comments on commit b0b6fb6

Please sign in to comment.