Model Metadata

It's possible to fetch model metadata without loading a model. This approach only fetches the data needed to provide the requested information and is therefore quite efficient even with large models.

Select a programming language:

 

py
import asyncio
import cartonml as carton
async def main():
info = await carton.get_model_info("https://carton.pub/cartonml/basic_example")
# ...
asyncio.run(main())

model_name

See the corresponding packing option for more details.

py
print(info.model_name)
# 'Test Model'

short_description

See the corresponding packing option for more details.

py
print(info.short_description)
# 'A short description that should be less than or equal to 100 characters.'

model_description

See the corresponding packing option for more details.

py
print(info.model_description)

license

See the corresponding packing option for more details.

py
print(info.license)

repository

See the corresponding packing option for more details.

py
print(info.repository)

homepage

See the corresponding packing option for more details.

py
print(info.homepage)

required_platforms

See the corresponding packing option for more details.

py
print(info.required_platforms)

inputs

See the corresponding packing option for more details.

py
print(info.inputs)

outputs

See the corresponding packing option for more details.

py
print(info.outputs)

self_tests

See the corresponding packing option for more details.

py
print(info.self_tests)
# Note: To get the value of an input or output tensor, call `get()` on it
# For example:
# await info.self_tests[0].inputs["f"].get()

examples

See the corresponding packing option for more details.

py
print(info.examples)
# Note: To get the value of an input or output tensor, call `get()` on it
# For example:
# await info.examples[0].inputs["x"].get()
#
# To read a misc file, call `read()` on it.
# For example:
# await info.examples[0].inputs["some_misc_input"].read()

misc_files

See the corresponding packing option for more details.

py
print(info.misc_files)
# To read a misc file, call `read()` on it.
# For example:
# await info.misc_files["model_architecture.png"].read()