models

Get safetensors metadata

Changed on

Get the parsed headers of all the shards of a sharded safetensors model in a single request, instead of reading the index and then the header of every shard.

Only the main revision is served: the ETag is the commit sha of main, and requests with a matching If-None-Match get a 304. Returns 400 when the path isn't a .safetensors.index.json file and 422 when the files can't be parsed.

The response is brotli-compressed when the client accepts it, otherwise gzip-compressed or plain JSON.

get/api/models/{namespace}/{repo}/safetensors-metadata/{path}

Request

  • Base URL: https://huggingface.co
  • URL: https://huggingface.co/api/models/{namespace}/{repo}/safetensors-metadata/{path}
  • Auth: HTTP bearer

Path parameters

namespacestring required
repostring required
pathstring required

Wildcard path parameter

Response

Parsed headers of the shards of a sharded safetensors model

shardedtrue required
headersobject required

The header of each shard, by shard file name: __metadata__, then the dtype, shape and data_offsets of each tensor

parameterCountobject required

Number of parameters per dtype

parameterTotalinteger
filepathsstring[] required

The index file, then every shard file

Changes