HuggingFaceModelDownloader icon indicating copy to clipboard operation
HuggingFaceModelDownloader copied to clipboard

SHA256 for LFS files not working

Open jaystevens opened this issue 1 month ago • 1 comments

SHA256 info from LFS file does not appear to be working/parsing as the SHA256 json tag is empty/missing. noticed this when trying to download an re-uploaded model that had a new SHA256, but this tool would not download the updated file.

can be duplicated by running: hfdownloader download Qwen/Qwen3-0.6B --dry-run --json

snipped from output:

    {
      "path": "model.safetensors",
      "url": "https://huggingface.co/Qwen%2FQwen3-0.6B/resolve/main/model.safetensors",
      "lfs": true,
      "size": 1503300328,
      "acceptRanges": true
    },

git clone'd Qwen3-0.6B/model.safetensors contents:

version https://git-lfs.github.com/spec/v1
oid sha256:f47f71177f32bcd101b7573ec9171e6a57f4f4d31148d38e382306f42996874b
size 1503300328

jaystevens avatar Nov 11 '25 21:11 jaystevens

huggingface.co/api/models/ is not returning a "sha256" field like your expecting under "lfs", so it never does SHA256 comparison on LFS files. The field "oid" under "lfs" appears to be the sha256, not sure if this is true 100% of the time, but probably is.

https://huggingface.co/api/models/Qwen/Qwen3-0.6B/tree/main

  {
    "type": "file",
    "oid": "a0458bbfda764d86cf930900d5f0f933933da9a3",
    "size": 1503300328,
    "lfs": {
      "oid": "f47f71177f32bcd101b7573ec9171e6a57f4f4d31148d38e382306f42996874b",
      "size": 1503300328,
      "pointerSize": 135
    },
    "xetHash": "6f87d3bff66602a9611e541180dec950a6b6a9068ca274ee43ac8f83550f0223",
    "path": "model.safetensors"
  },

jaystevens avatar Nov 11 '25 21:11 jaystevens