8000 Add support for DistilBert by huydt84 · Pull Request #13907 · ggml-org/llama.cpp · GitHub
[go: up one dir, main page]

Skip to content

Add support for DistilBert #13907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
small fixes
  • Loading branch information
huydt-bti committed May 30, 2025
commit 2b2cf6db8f2971dfc60d920eb520d6a1c68a6669
1 change: 1 addition & 0 deletions convert_hf_to_gguf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3920,6 +3920,7 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
if name.startswith("distilbert."):
name = name[11:]

# These layers act as MLM head, so we don't need them
if name.startswith("vocab_"):
return []

Expand Down
4 changes: 1 addition & 3 deletions src/llama-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2116,9 +2116,7 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
case LLM_ARCH_NOMIC_BERT_MOE:
{
tok_embd = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}, 0);
if (arch != LLM_ARCH_DISTIL_BERT) {
type_embd = create_tensor(tn(LLM_TENSOR_TOKEN_TYPES, "weight"), {n_embd, n_token_types}, 0);
}
type_embd = create_tensor(tn(LLM_TENSOR_TOKEN_TYPES, "weight"), {n_embd, n_token_types}, TENSOR_NOT_REQUIRED);

if (arch == LLM_ARCH_BERT || arch == LLM_ARCH_DISTIL_BERT) {
pos_embd = create_tensor(tn(LLM_TENSOR_POS_EMBD, "weight"), {n_embd, n_ctx_train}, 0);
Expand Down
Loading
0