tinyms.hub

tinyms.hub.load(uid, pretrained=True, **kwargs)[源代码]

Load a model from remote TinyMS Hub.

参数
  • uid (str) – Uid. The format should be strictly consistent with the official example: tinyms/0.2/lenet5_v1_mnist.

  • pretrained (bool) – Specified if to load pretrained weight ckpt file. Default: True.

  • kwargs (dict, optional) – Keyword arguments for network initialization.

返回

layers.Layer, the initialized network instance.

实际案例

>>> from tinyms import hub
>>>
>>> hub.load('tinyms/0.2/lenet5_v1_mnist', class_num=10)
tinyms.hub.load_checkpoint(uid, dst, pretrained=True, **kwargs)[源代码]

Load model checkpoint file from remote TinyMS Hub.

参数
  • uid (str) – Uid. The format should be strictly consistent with the official example: tinyms/0.2/lenet5_v1_mnist.

  • dst (str) – Full path of filename where the checkpoint file will be loaded, e.g. /tmp/lenet5.ckpt.

  • pretrained (bool) – Specified if to load pretrained weight ckpt file. Default: True.

  • kwargs (dict, optional) – Keyword arguments for network initialization.

实际案例

>>> from tinyms import hub
>>>
>>> hub.load_checkpoint('tinyms/0.2/lenet5_v1_mnist', '/tmp/lenet5.ckpt', class_num=10)
tinyms.hub.load_weights(uid)[源代码]

Load model pretrained weights from remote TinyMS Hub.

参数

uid (str) – Uid. The format should be strictly consistent with the official example: tinyms/0.2/lenet5_v1_mnist.

返回

Dict, the pretrained network weight dict.

实际案例

>>> from tinyms import hub
>>> from tinyms.model import lenet5
>>> from tinyms.utils.train import load_param_into_net
>>>
>>> param_dict = hub.load_weights('tinyms/0.2/lenet5_v1_mnist')
>>> net = lenet5()
>>> load_param_into_net(net, param_dict)