ModelDownloader

class ModelDownloader.ModelDownloader(sparkSession, localPath, serverURL='https://mmlspark.azureedge.net/datasets/CNTKModels/')[source]

Bases: object

A class for downloading CNTK pretrained models in python. To download all models use the downloadModels function. To browse models from the microsoft server please use remoteModels.

Parameters:
  • sparkSession (SparkSession) – A spark session for interfacing between python and java
  • localPath (str) – The folder to save models to
  • serverURL (str) – The location of the model Server, beware this default can change!
downloadByName(name)[source]

Downloads a named model

Parameters:name (str) – The name of the model
downloadModel(model)[source]

Download a model

Parameters:model (object) – The model to be downloaded
Returns:model schema
Return type:object
downloadModels(models=None)[source]

Download models

Parameters:models – The models to be downloaded
Returns:list of models downloaded
Return type:list
localModels()[source]

Downloads models stored locally on the filesystem

remoteModels()[source]

Downloads models stored remotely.

class ModelDownloader.ModelSchema(name, dataset, modelType, uri, hash, size, inputNode, numLayers, layerNames)[source]

Bases: object

An object that represents a model.

Parameters:
  • name (str) – Name of the model
  • dataset (DataFrame) – Dataset it was trained on
  • modelType (str) – Domain that the model operates on
  • uri (str) – The location of the model’s bytes
  • hash (str) – The sha256 hash of the models bytes
  • size (int) – the size of the model in bytes
  • inputNode (int) – the node which represents the input
  • numLayers (int) – the number of layers of the model
  • layerNames (array) – the names of nodes that represent layers in the network
static fromJava(jobj)[source]
toJava(sparkSession)[source]