This commit is contained in:
Dan Saunders
2025-08-29 22:54:21 -04:00
parent df870f6a8f
commit 89d5323c13
7 changed files with 16 additions and 27 deletions

View File

@@ -9,8 +9,6 @@ except ImportError as exc:
raise ImportError("Install torch via `pip install torch`") from exc
from packaging.version import Version as V
USE_UV = "--uv" in sys.argv[1:]
v = V(torch.__version__)
# no cut-cross-entropy support for torch < 2.4.0
@@ -23,12 +21,9 @@ cce_spec = importlib.util.find_spec("cut_cross_entropy")
UNINSTALL_PREFIX = ""
if cce_spec:
if not importlib.util.find_spec("cut_cross_entropy.transformers"):
uninstall_cmd = "uv pip uninstall" if USE_UV else "pip"
UNINSTALL_PREFIX = f"{uninstall_cmd} uninstall -y cut-cross-entropy && "
UV_PREFIX = "uv " if USE_UV else ""
UNINSTALL_PREFIX = "uv pip uninstall -y cut-cross-entropy && "
print(
UNINSTALL_PREFIX
+ f'{UV_PREFIX}pip install "cut-cross-entropy[transformers] @ git+https://github.com/axolotl-ai-cloud/ml-cross-entropy.git@147ea28"'
+ 'uv pip install --system "cut-cross-entropy[transformers] @ git+https://github.com/axolotl-ai-cloud/ml-cross-entropy.git@c6a32c5"'
)