forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "glue" between training WASM artifacts and training web (microsof…
…t#17474) ### Description * follows the packaging approach according to the design document * adds `ENABLE_TRAINING` boolean flag to `BUILD_DEFS` * modifies `package.json` to include training submodule * modifies build script to handle, validate, and minimize training WASM artifacts * adds the binding for the new backend with training enabled & the new training artifacts * adds training backend * edits `index.ts` to use training backend depending on `BUILD_DEFS` * edits `wasm-factory.ts` to use the training artifacts if necessary ### Motivation and Context * we are in the process of adding web bindings to enable training. * Adding the "glue" to allow onnxruntime-web to use the training WASM artifacts is required for this work. * Since BUILD_DEFS is defined and used at build time, I thought that it made sense to bundle the changes to building in the same PR. #### Related work * microsoft#16521 allowed for training artifacts to be built * microsoft#17333 must be merged in before this one --------- Co-authored-by: Yulong Wang <[email protected]>
- Loading branch information
Showing
9 changed files
with
77 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
import {OnnxruntimeWebAssemblyBackend} from './backend-wasm'; | ||
export const wasmBackend = new OnnxruntimeWebAssemblyBackend(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
import {InferenceSession, TrainingSessionHandler} from 'onnxruntime-common'; | ||
|
||
import {OnnxruntimeWebAssemblyBackend} from './backend-wasm'; | ||
|
||
class OnnxruntimeTrainingWebAssemblyBackend extends OnnxruntimeWebAssemblyBackend { | ||
async createTrainingSessionHandler( | ||
_checkpointStateUriOrBuffer: string|Uint8Array, _trainModelUriOrBuffer: string|Uint8Array, | ||
_evalModelUriOrBuffer: string|Uint8Array, _optimizerModelUriOrBuffer: string|Uint8Array, | ||
_options: InferenceSession.SessionOptions): Promise<TrainingSessionHandler> { | ||
throw new Error('Method not implemented yet.'); | ||
} | ||
} | ||
|
||
export const wasmBackend = new OnnxruntimeTrainingWebAssemblyBackend(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters