Model

class Model(owner, model_id, date, model_type, name, metadata, model, verbose, producer, input_spec, output_spec, producer_id=None)

Neural network model object.

A model should not be constructed directly. It is constructed by the hub client through upload_model(), get_model(), or get_models().

model_id

The model ID.

Type:

str

date

The time this model was uploaded.

Type:

datetime

model_type

The type of the model.

Type:

SourceModelType

name

An optional user-provided name to identify the model.

Type:

str

metadata

Model metadata.

Type:

dict[ModelMetadataKey, str]

input_spec

Input tensor specifications. A dict mapping graph name to a list of TensorSpec. For single-graph models the key is None. For multi-graph models (e.g. linked context binaries) each key is the graph name.

Type:

IOSpec

output_spec

Output tensor specifications. Same structure as input_spec.

Type:

IOSpec

disable_sharing()

Disable all sharing for this model.

Note that the model will still be accessible by users with which related job(s) are shared.

戻り値の型:

None

download(filename)

Downloads source model to file.

パラメータ:

filename (str) -- If the filename doesn't end with the correct file extension, the appropriate file extension is added to the name.

戻り値:

Filename of the downloaded model.

戻り値の型:

str

get_producer()

The job that produced this model, or None if the model was uploaded directly.

On first access this will trigger a network call to fetch the producer job, if the model has one. Subsequent calls return the cached value.

戻り値の型:

Job | None

get_sharing()

Get the list of email addresses of users that this model has been shared with.

戻り値の型:

list[str]

modify_sharing(add_emails=None, delete_emails=None)

Modifies the list of users that the model is shared with.

If this model was compiled by hub, it will have an associated Compile Job. The associated Compile Job will not be visible unless said Compile Job is also shared.

戻り値の型:

None

property producer: Job | None

Deprecated. Use get_producer() instead.

property url: str

Returns the URL for the model.

戻り値:

The URL for the model.

戻り値の型:

str