`tf.io.browserFiles` doesn't fail when loading invalid files. or rather, it fails, but never rejects the promise, making the `IOHandler.load` hang forever.
wrapping the `JSON.parse` call in a try/catch and rejecting accordingly did the trick. and a small test to try it out.
note: `FileReader.readAsText()` is a callback way to go around reading files. the promise-based `Blob.text()` would make `BrowserFile.load` simpler and safer (but felt ouf-of-scope here).
* Remove --no-site-packages flag from virtualenv.
* change python version to least supported version.
---------
Co-authored-by: Matthew Soulanille <msoulanille@google.com>
Move GCP presubmits to Github actions. This allows us to run WebGL / WebGPU tests, since Github Actions have a MacOS runner with a GPU. This should unblock several PRs.
BUG
These properties must be quoted since they are used by parseDtypeParam in tfjs-converter/src/operations/operation_mapper.ts to look up dtypes by string name. If they are not quoted, Closure will mangle their names.
* Update supported TypedArray data types in tf.tensor in the documentation
* Address Exceeds maximum line length of 80 tslint error
* Address Exceeds maximum line length of 80 tslint error again
* Address no-consecutive-blank-lines tslint error
* Fix for windows installation #7341
Fix a problem with the installation on windows.
My problem on windows was that `./lib/napi-v9` directory didn't exist and `./scripts/deps-stage.js` on line **60** needed the path to symlink or copy the dll.
My fix was to make sure that the directory `napi-v9` exists with:
`await fs.mkdir(path.dirname(destLibTensorFlowPath), {recursive: true})`;
I'm solving the copy issue with this code.
* Fix fs.mkdir usage in deps-stage.js
When downloading model weight data, slice it into weight tensors and push them to the GPU eagerly. This avoids storing an extra copy of the weights on CPU, allowing for larger models (1.3B to possibly ~6.7B or larger) to be loaded without causing a V8 OOM crash.
When streaming the weights, check CPU_HANDOFF_SIZE_THRESHOLD or WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD to determine whether the weight should be sent to GPU or remain on CPU.
This feature is guarded by the streamWeights option in LoadOptions. Since most of TFJS's graph model saving relies on the CPU copy of the model, model saving is disabled when the model was streamed (i.e. it will throw an error since the weights ArrayBuffer is missing).
BUG
While node is not supported, 'isWebGPUSupported' should return false instead of
throwing an error. This fixes pose-detection node tests, which use the same
files as the browser tests.
* webgpu: apply the new timestampWrites format
* Add types/dom-webcodecs to fix bots errors
* downgrade @types/dom-webcodecs version
* try @types/dom-webcodecs: 0.1.4
Worker tests were getting the path for `importScripts` by referencing
`location.origin`, but this is `blob://` when accessed from the worker
context.
Template `location.origin` from the main context into the worker source code
instead of accessing the worker's version of `location.origin`.