Skip to content

[Refactor 3] Abandoning HuggingFace API for Model Architecture Source Code (Related to Refactor 2) #50

Description

@willxxy

Background:
Related to Problem 6 of issue 49.
We use the Huggingface API to load in models like so:

hf_llm = AutoModelForCausalLM.from_pretrained(
                HF_LLMS[self.args.llm]["model"],
                dtype=HF_LLMS[self.args.llm]["native_dtype"],
                attn_implementation=self.args.attention_type,
            )

Problem:

  1. It is difficult to incorporate custom modifications to the LLM (e.g., deepstack to qwen 2.5 model). You have to touch the API code, which we should not do (unless we separately maintain a fork of HF API, which we are DEFINITELY not doing).

Solution:

  1. Implement the bare minimum, correct, source code of the LLM architecture (use HF as a reference) and then implement logic for loading in weights (following HF API).

Additional Notes:

  1. Vision encoders also use HF API to load in model. However, since the probability of modifying a vision encoder is quite small and we mostly use custom ECG models (with the source code already included), we can have this less of a priority.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions