Skip to content

Commit 637c9d2

Browse files
Fix minicpm o (#3115)
1 parent ed60cc9 commit 637c9d2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

notebooks/minicpm-o-omnimodal-chatbot/minicpm_o_helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ def patch_model_code(orig_model_dir):
313313
content = f.read()
314314
content = content.replace("if is_flash_attn_2_available():", "")
315315
content = content.replace("from flash_attn import flash_attn_func", "")
316+
content = content.replace("from flash_attn import flash_attn_varlen_func", "")
316317
content = content.replace("from flash_attn.bert_padding import index_first_axis", "")
317318
content = content.replace("from flash_attn.bert_padding import pad_input", "")
318319
content = content.replace("from flash_attn.bert_padding import unpad_input", "")
@@ -650,7 +651,7 @@ def convert_minicpmo26(model_id, remove_checkpoint=False):
650651
snapshot_download(model_id, local_dir=ckpt, force_download=True)
651652
patch_model_code(ckpt)
652653
model = AutoModel.from_pretrained(
653-
model_id,
654+
ckpt,
654655
trust_remote_code=True,
655656
attn_implementation="sdpa", # sdpa or flash_attention_2
656657
torch_dtype=torch.float32,

0 commit comments

Comments
 (0)