JSPM

tfjs-azure-io-handler

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q11008F
  • License MIT

A package to save/load to/from azure when working with `@tensorflow/tfjs`

Package Exports

  • tfjs-azure-io-handler
  • tfjs-azure-io-handler/dist/index.cjs
  • tfjs-azure-io-handler/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tfjs-azure-io-handler) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Tfjs azure IO handler

tfjs-azure-io-handler provides a handler to save and load models from TensorFlow.js to an Azure storage account

Usage

Using an Azure container SAS token:

import createAzureIoHandler from "tfjs-azure-io-handler";

const handler = createAzureIoHandler(
  "location/within/azure/container",
  {
    containerName: "<container name>",
    storageAccount: "<storage account name>",
    storageSasToken: "<storage account sas token>",
  },
);

const model = await tf.loadLayersModel(handler);

await model.save(handler);

Using an Azure storage access key:

import { StorageSharedKeyCredential } from "@azure/storage-blob";
import createAzureIoHandler from "tfjs-azure-io-handler";

const handler = createAzureIoHandler(
  "location/within/azure/container",
  {
    containerName: "<container name>",
    storageAccount: "<storage account name>",
    credential: new StorageSharedKeyCredential(
      "<storage account name>",
      "<storage account key>"
    ),
  },
);

const model = await tf.loadLayersModel(handler);

await model.save(handler);

Using an anonymous connection:

import { AnonymousCredential } from "@azure/storage-blob";
import createAzureIoHandler from "tfjs-azure-io-handler";

const handler = createAzureIoHandler(
  "location/within/azure/container",
  {
    containerName: "<container name>",
    storageAccount: "<storage account name>",
    credential: new AnonymousCredential(),
  },
);

const model = await tf.loadLayersModel(handler);

// 🚫 Saving is not permitted by Azure when using `AnonymousCredential`