Skip to content

Commit

Permalink
commit transformers bump
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfeil committed Jun 9, 2024
1 parent 2e1e808 commit a2435a6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self, *, engine_args=EngineArgs):
)

if engine_args.compile:
logger.info("using torch.compile()")
logger.info("using torch.compile(dynamic=True)")
fm.auto_model = torch.compile(fm.auto_model, dynamic=True)

def encode_pre(self, sentences) -> dict[str, "Tensor"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def __init__(self, *, engine_args: EngineArgs):
self.engine_args = engine_args

if engine_args.compile:
self.model.vision_model = torch.compile(self.model.vision_model)
self.model.text_model = torch.compile(self.model.text_model)
self.model.vision_model = torch.compile(self.model.vision_model, dynamic=True)
self.model.text_model = torch.compile(self.model.text_model, dynamic=True)

assert hasattr(
self.model, "get_text_features"
Expand Down
8 changes: 4 additions & 4 deletions libs/infinity_emb/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/infinity_emb/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pydantic = {version = ">=2.4.0,<3", optional=true}
# backend
torch = {version = "2.3.1", source = "pypi", optional=true}
sentence-transformers = {version = "^3.0.1", optional=true}
transformers = {version = ">4.34.0,<4.39.2", optional=true}
transformers = {version = ">4.34.0,<4.39.4", optional=true}
ctranslate2 = {version = "^4.0.0", optional=true}
optimum = {version = ">=1.16.2", optional=true, extras=["onnxruntime"]}
hf_transfer = {version=">=0.1.5"}
Expand Down
4 changes: 3 additions & 1 deletion libs/infinity_emb/tests/end_to_end/test_ct2_sentence.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def test_load_model(model_base):
s = ["This is a test sentence."]
e1 = model_base.encode(s)
e2 = CT2SentenceTransformer(
engine_args=EngineArgs(model_name_or_path=MODEL, device="cpu")
engine_args=EngineArgs(
model_name_or_path=MODEL, device="cpu", bettertransformer=False
)
).encode(s)
np.testing.assert_almost_equal(e1, e2, decimal=6)

Expand Down

0 comments on commit a2435a6

Please sign in to comment.