Skip to content

Commit e3b6b15

Browse files
danbevnjsyw1997
authored andcommitted
requirements : update transformers/torch for Embedding Gemma (ggml-org#15828)
* requirements : update transformers/torch for Embedding Gemma This commit updates the requirements to support converting Embedding Gemma 300m models. The motivation for this change is that during development I had a local copy of the transformers package which is what I used for converting the models. This was a mistake on my part and I should have also updated my transformers version to the official release. I had checked the requirements/requirements-convert_legacy_llama.txt file and noted that the version was >=4.45.1,<5.0.0 and came to the conculusion that no updated would be needed, this assumed that Embedding Gemma would be in a transformers release at the time Commit fb15d64 ("llama : add support for EmbeddingGemma 300m (ggml-org#15798)) was merged. So anyone wanting to convert themselves would be able to do so. However, Embedding Gemma is a preview release and this commit updates the requirements to use this preview release. * resolve additional python dependencies * fix pyright errors in tokenizer test and remove unused import
1 parent 7784354 commit e3b6b15

File tree

7 files changed

+21
-10
lines changed

7 files changed

+21
-10
lines changed

requirements/requirements-convert_hf_to_gguf.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ mistral-common>=1.8.3
22

33
-r ./requirements-convert_legacy_llama.txt
44
--extra-index-url https://download.pytorch.org/whl/cpu
5-
torch~=2.4.0; platform_machine != "s390x"
5+
6+
## Embedding Gemma requires PyTorch 2.6.0 or later
7+
torch~=2.6.0; platform_machine != "s390x"
68

79
# torch s390x packages can only be found from nightly builds
810
--extra-index-url https://download.pytorch.org/whl/nightly
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
numpy~=1.26.4
22
sentencepiece~=0.2.0
3-
transformers>=4.45.1,<5.0.0
3+
4+
# Embedding Gemma is currently a preview release:
5+
# https://github.com/huggingface/transformers/releases/tag/v4.56.0-Embedding-Gemma-preview
6+
7+
# The version is needed to be able to convert Embedding Gemma models to GGUF format:
8+
git+https://github.com/huggingface/transformers@v4.56.0-Embedding-Gemma-preview
9+
10+
# Once Embedding Gemma is officially released, we can switch to:
11+
#transformers>=4.57.1,<5.0.0
12+
413
gguf>=0.1.0
514
protobuf>=4.21.0,<5.0.0

requirements/requirements-tool_bench.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
aiohttp~=3.9.3
22
pytest~=8.3.3
3-
huggingface_hub~=0.23.2
3+
huggingface_hub>=0.34.0,<1.0
44
matplotlib~=3.10.0
55
numpy~=1.26.4
66
openai~=1.55.3

tests/test-tokenizer-random.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,10 @@ def check_detokenizer(text: str, text1: str, text2: str) -> bool:
421421
if text1 == text2: # equal to TokenizerGroundtruth?
422422
return True
423423
# equal to source text?
424-
if tokenizer1.add_bos_token: # remove BOS
424+
if tokenizer1.add_bos_token and tokenizer1.bos_token and isinstance(tokenizer1.bos_token, str): # remove BOS
425425
if text2.startswith(tokenizer1.bos_token):
426426
text2 = text2[len(tokenizer1.bos_token):]
427-
if tokenizer1.add_eos_token: # remove EOS
427+
if tokenizer1.add_eos_token and tokenizer1.eos_token and isinstance(tokenizer1.eos_token, str): # remove EOS
428428
if text2.endswith(tokenizer1.eos_token):
429429
text2 = text2[:-len(tokenizer1.eos_token)]
430430
return text == text2

tools/mtmd/legacy-models/minicpmv-convert-image-encoder-to-gguf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import numpy as np
2424
import torch
2525
import torch.nn.functional as F
26-
import torch.utils.checkpoint
2726
from torch import nn
2827
from torch.nn.init import _calculate_fan_in_and_fan_out
2928

@@ -413,7 +412,8 @@ def get_input_embeddings(self) -> nn.Module:
413412

414413
import numpy as np
415414
from gguf import *
416-
from transformers.models.idefics2.modeling_idefics2 import Idefics2VisionTransformer, Idefics2VisionConfig
415+
from transformers.models.idefics2.modeling_idefics2 import Idefics2VisionTransformer
416+
from transformers.models.idefics2.configuration_idefics2 import Idefics2VisionConfig
417417

418418
TEXT = "clip.text"
419419
VISION = "clip.vision"

tools/mtmd/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-r ../../requirements/requirements-convert_legacy_llama.txt
22
--extra-index-url https://download.pytorch.org/whl/cpu
33
pillow~=11.3.0
4-
torch~=2.4.0
5-
torchvision~=0.19.1
4+
torch~=2.6.0
5+
torchvision~=0.21.0

tools/server/tests/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
aiohttp~=3.9.3
22
pytest~=8.3.3
3-
huggingface_hub~=0.23.2
3+
huggingface_hub>=0.34.0,<1.0
44
numpy~=1.26.4
55
openai~=1.55.3
66
prometheus-client~=0.20.0

0 commit comments

Comments
 (0)