Package Exports
- tfjs-azure-io-handler
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`