resolve_weights
resolve_weights(reference)Turn any of the three forms into a local file, downloading if it has to.
Downloads land in the Hugging Face cache - ~/.cache/huggingface/hub unless HF_HOME says otherwise - which is outside any virtual environment, so the file survives an environment being rebuilt. Asking twice costs nothing: the cache is addressed by content and a pinned commit needs no network call once it is there.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| reference | str | One of three forms - a registry name such as dsbowl-unet, an explicit hf://owner/repo/file.safetensors@commit, or a path to a local file. The hf:// form requires the commit: main is not a version, and weights that change under a stable name are the worst kind of irreproducibility, because the code is identical and the result is not. |
required |
Returns
| Name | Type | Description |
|---|---|---|
| Path | A path to a local file, downloading it first if it is not already in the cache. |
Raises
| Name | Type | Description |
|---|---|---|
| WeightsError | If the name is not in the registry, the hf:// form has no commit, a local path does not exist, or huggingface_hub is needed and absent - which it is unless pyplatypus[hub] is installed. |
There is no doctest here on purpose: every branch of this either reaches the network or wants a file that exists, and an example that cannot run is a claim nobody checks. available_weights() is the one to call to see what the names are.