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:
import asyncioimport 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.
print(info.model_name)# 'Test Model'
short_description
See the corresponding packing option for more details.
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.
print(info.model_description)
license
See the corresponding packing option for more details.
print(info.license)
repository
See the corresponding packing option for more details.
print(info.repository)
homepage
See the corresponding packing option for more details.
print(info.homepage)
required_platforms
See the corresponding packing option for more details.
print(info.required_platforms)
inputs
See the corresponding packing option for more details.
print(info.inputs)
outputs
See the corresponding packing option for more details.
print(info.outputs)
self_tests
See the corresponding packing option for more details.
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.
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.
print(info.misc_files)
# To read a misc file, call `read()` on it.# For example:# await info.misc_files["model_architecture.png"].read()