Skip to content

Commit

Permalink
deploy: c13aef7
Browse files Browse the repository at this point in the history
  • Loading branch information
swfsql committed Feb 29, 2024
1 parent 8c74a22 commit 0db1dac
Show file tree
Hide file tree
Showing 10 changed files with 1,243 additions and 2 deletions.
17 changes: 16 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
<!doctype html><html class=has-navbar-fixed-bottom lang=en><meta charset=text/html;utf-8><meta content="width=device-width,initial-scale=1" name=viewport><title>Mamba-Minimal dfdx Example</title><link href=https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css rel=stylesheet><link as=fetch crossorigin href=./mamba-minimal-dfdx-example-6942ab83f543d1d3_bg.wasm integrity=sha384-wsG2hYn4VRcL4a49lSid75ahi_WE7Hqpk_DP_5V687ABvLJXVSu2cEgvfxHsE4mR rel=preload type=application/wasm><link crossorigin href=./mamba-minimal-dfdx-example-6942ab83f543d1d3.js integrity=sha384-PW1JeEI4gAWb_inYmT8xqY0AHVOYQko5GM2MFkkDu9ojlNNEmCe9qFtyezIMIa1U rel=modulepreload></head><body><noscript>This page uses wasm and js. Please enable them.</noscript><script src=./index.js type=module></script><script type=module>import a,*as b from"./mamba-minimal-dfdx-example-6942ab83f543d1d3.js";a(`./mamba-minimal-dfdx-example-6942ab83f543d1d3_bg.wasm`);window.wasmBindings=b</script></body></html>
<!DOCTYPE html>
<html lang="en" class="has-navbar-fixed-bottom">

<head>
<meta charset="text/html;utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Mamba-Minimal dfdx Example</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css">
</head>

<body>
<noscript>This page uses wasm and js. Please enable them.</noscript>
<script type="module" src="./index.js"></script>
</body>

</html>
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import init, {
wasm_main,
} from "./pkg/mamba_minimal_dfdx_example.js";

async function run() {
await init();
wasm_main();
}
run();
1 change: 0 additions & 1 deletion mamba-minimal-dfdx-example-6942ab83f543d1d3.js

This file was deleted.

Binary file removed mamba-minimal-dfdx-example-6942ab83f543d1d3_bg.wasm
Binary file not shown.
27 changes: 27 additions & 0 deletions pkg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# mamba-minimal-dfdx-example

Click [here](https://swfsql.github.io/mamba-minimal-dfdx-example/) to run the model in your browser.

### Information

Adapted from [huggingface/candle/mamba-minimal](https://github.com/huggingface/candle/blob/fd7c8565646039e35925b8730d27ddad195d7e73/candle-examples/examples/mamba-minimal/).

### Building

##### Native
```bash
RUSTFLAGS="-C target-cpu=native"
cargo run --release --no-default-features --features "native"
```

##### WASM
```bash
# no-ui (web console only)
wasm-pack build --release --target web --no-default-features

# yew web ui
wasm-pack build --release --target web --no-default-features --features "wasm_yew_ui"

# serve
http -a 127.0.0.1
```
47 changes: 47 additions & 0 deletions pkg/mamba_minimal_dfdx_example.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* tslint:disable */
/* eslint-disable */
/**
* @returns {Promise<void>}
*/
export function wasm_main(): Promise<void>;

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly wasm_main: () => number;
readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_export_2: WebAssembly.Table;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly wasm_bindgen__convert__closures__invoke1_mut__hd900a1c510a7707a: (a: number, b: number, c: number, d: number) => void;
readonly wasm_bindgen__convert__closures__invoke0_mut__h8a02d42e2eddadcb: (a: number, b: number) => void;
readonly wasm_bindgen__convert__closures__invoke1_ref__hb15501be9eb16ca5: (a: number, b: number, c: number) => void;
readonly wasm_bindgen__convert__closures__invoke1_mut__hf3471ddd9a2ede48: (a: number, b: number, c: number) => void;
readonly _dyn_core__ops__function__Fn_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h54161439976fad6b: (a: number, b: number) => void;
readonly _dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3aae48ea73e72c08: (a: number, b: number, c: number) => void;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
readonly __wbindgen_exn_store: (a: number) => void;
readonly wasm_bindgen__convert__closures__invoke2_mut__h30097a3fa11435cd: (a: number, b: number, c: number, d: number) => void;
}

export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {SyncInitInput} module
*
* @returns {InitOutput}
*/
export function initSync(module: SyncInitInput): InitOutput;

/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
Loading

0 comments on commit 0db1dac

Please sign in to comment.