chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:39:21 +08:00
commit bc34f6df14
1149 changed files with 328099 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
"""
Common pytest fixtures and configuration for FlagEmbedding tests.
"""
import os
import pytest
import torch
from packaging import version
import transformers
# Check if we're using transformers v5+
TF_VER = version.parse(getattr(transformers, "__version__", "0.0.0"))
IS_TF_V5_OR_HIGHER = TF_VER >= version.parse("5.0.0")
@pytest.fixture(scope="session")
def device():
"""Return the device to use for tests."""
return "cuda" if torch.cuda.is_available() else "cpu"
@pytest.fixture(scope="session")
def transformers_version():
"""Return the transformers version."""
return TF_VER