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_nameSee the corresponding packing option for more details.
print(info.model_name)# 'Test Model'short_descriptionSee 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_descriptionSee the corresponding packing option for more details.
print(info.model_description)licenseSee the corresponding packing option for more details.
print(info.license)repositorySee the corresponding packing option for more details.
print(info.repository)homepageSee the corresponding packing option for more details.
print(info.homepage)required_platformsSee the corresponding packing option for more details.
print(info.required_platforms)inputsSee the corresponding packing option for more details.
print(info.inputs)outputsSee the corresponding packing option for more details.
print(info.outputs)self_testsSee 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()examplesSee 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_filesSee 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()