Skip to content

Feature Request: Support for Phi-4-mini-instruct #12091

Closed
@MoonRide303

Description

@MoonRide303

Prerequisites

  • I am running the latest code. Mention the version if possible as well.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new and useful enhancement to share.

Feature Description

Phi-4-mini-instruct uses Phi3ForCausalLM architecture, but conversion fails:

python D:\repos-git\llama.cpp\convert_hf_to_gguf.py --outtype f16 ..\Phi-4-mini-instruct\ --outfile Phi-4-mini-instruct-F16.gguf
INFO:hf-to-gguf:Loading model: Phi-4-mini-instruct
INFO:gguf.gguf_writer:gguf: This GGUF file is for Little Endian only
INFO:hf-to-gguf:Exporting model...
Traceback (most recent call last):
  File "D:\repos-git\llama.cpp\convert_hf_to_gguf.py", line 5112, in <module>
    main()
  File "D:\repos-git\llama.cpp\convert_hf_to_gguf.py", line 5106, in main
    model_instance.write()
  File "D:\repos-git\llama.cpp\convert_hf_to_gguf.py", line 439, in write
    self.prepare_tensors()
  File "D:\repos-git\llama.cpp\convert_hf_to_gguf.py", line 280, in prepare_tensors
    for name, data_torch in chain(self.generate_extra_tensors(), self.get_tensors()):
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\repos-git\llama.cpp\convert_hf_to_gguf.py", line 2568, in generate_extra_tensors
    raise ValueError(f'The length of rope long and short factors must be {rope_dims / 2}')
ValueError: The length of rope long and short factors must be 64.0

Tested using script from b4783.

After disabling rope in config.json ("rope_scaling": null,) it fails at pre-tokenizer:

  File "D:\repos-git\llama.cpp\convert_hf_to_gguf.py", line 716, in get_vocab_base_pre
    raise NotImplementedError("BPE pre-tokenizer was not recognized - update get_vocab_base_pre()")
NotImplementedError: BPE pre-tokenizer was not recognized - update get_vocab_base_pre()

Motivation

Phi series was supported so far, and people might be interested in Phi-4-mini-instruct as well.

Possible Implementation

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions