Skip to content

KeyError: 'dims' when running convert-pt-to-ggml.py on safetensors/pytorch models #3315

Open
@officiallyutso

Description

@officiallyutso

Overview

Running the official convert-pt-to-ggml.py (or convert-h5-to-ggml.py) script fails when inputting safetensors or .bin model files without a "dims" field in the checkpoint metadata. This has occurred across multiple model types (e.g., distil-whisper variants, custom Hugging Face checkpoints) and is still open with no resolution as of now 1 , 2.

Environment

  • Repository version: latest as of July 11, 2025
  • Scripts: convert-pt-to-ggml.py, possibly convert-h5-to-ggml.py
  • Input formats: Safetensors (*.safetensors), .pt or .bin format lacking "dims" in metadata
  • Platform: Linux/macOS/Windows (script-based usage)

Observed Behavior

Running conversion typically results in:

KeyError: 'dims'

for example at:

hparams = checkpoint["dims"]

Why It Matters

  • The error blocks users from importing many fine-tuned or community Whisper variants that come in safetensors format.
  • Without clear guidance or script support, users must manually patch metadata or rebuild a valid checkpoint—leading to errors and inconsistency.
  • Clarifying compatibility will improve usability and widen practical model support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions