From c5c21761a2027d81d695e048c498c035ce2345ed Mon Sep 17 00:00:00 2001 From: IlyasMoutawwakil Date: Wed, 4 Sep 2024 10:09:33 +0200 Subject: [PATCH 1/3] update --- .github/workflows/quality.yaml | 4 ++-- .github/workflows/release.yaml | 8 ++++---- setup.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml index 86fe496..31377f3 100644 --- a/.github/workflows/quality.yaml +++ b/.github/workflows/quality.yaml @@ -17,10 +17,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.10" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6b86b5e..202f428 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -9,19 +9,19 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Install requirements + - name: Install release requirements run: | pip install --upgrade pip pip install setuptools wheel twine - - name: Build and publish + - name: Build and publish release env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} diff --git a/setup.py b/setup.py index 880f3ba..edcda77 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import find_packages, setup -PY_TXI_VERSION = "0.9.0" +PY_TXI_VERSION = "0.10.0" common_setup_kwargs = { "author": "Ilyas Moutawwakil", From 163777ee543943887291821bdb1434bf8c0c771a Mon Sep 17 00:00:00 2001 From: IlyasMoutawwakil Date: Wed, 4 Sep 2024 10:49:13 +0200 Subject: [PATCH 2/3] misc updates --- example.py | 21 +++++++++++---------- py_txi/text_embedding_inference.py | 6 +++--- py_txi/text_generation_inference.py | 8 ++++---- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/example.py b/example.py index de3f57b..9673ef5 100644 --- a/example.py +++ b/example.py @@ -1,14 +1,15 @@ from py_txi.text_embedding_inference import TEI, TEIConfig from py_txi.text_generation_inference import TGI, TGIConfig -llm = TGI(config=TGIConfig(model_id="bigscience/bloom-560m", gpus="0")) -output = llm.generate(["Hi, I'm a language model", "I'm fine, how are you?"]) -print(len(output)) -print("LLM:", output) -llm.close() +for gpus in [None, "1", "1,2"]: + llm = TGI(config=TGIConfig(model_id="bigscience/bloom-560m", gpus=gpus)) + output = llm.generate(["Hi, I'm a language model", "I'm fine, how are you?"]) + print(len(output)) + print("LLM:", output) + llm.close() -embed = TEI(config=TEIConfig(model_id="BAAI/bge-base-en-v1.5")) -output = embed.encode(["Hi, I'm an embedding model", "I'm fine, how are you?"]) -print(len(output)) -print("Embed:", output) -embed.close() + embed = TEI(config=TEIConfig(model_id="BAAI/bge-base-en-v1.5", gpus=gpus)) + output = embed.encode(["Hi, I'm an embedding model", "I'm fine, how are you?"]) + print(len(output)) + print("Embed:", output) + embed.close() diff --git a/py_txi/text_embedding_inference.py b/py_txi/text_embedding_inference.py index 640adb9..9d765d0 100644 --- a/py_txi/text_embedding_inference.py +++ b/py_txi/text_embedding_inference.py @@ -28,10 +28,10 @@ def __post_init__(self) -> None: if self.image is None: if is_nvidia_system() and self.gpus is not None: - LOGGER.info("\t+ Using the latest NVIDIA GPU image for Text-Embedding-Inference") - self.image = "ghcr.io/huggingface/text-embeddings-inference:latest" + LOGGER.info("\t+ Using latest NVIDIA CUDA GPU image for Text-Embedding-Inference") + self.image = "ghcr.io/huggingface/text-embeddings-inference:cuda-latest" else: - LOGGER.info("\t+ Using version 1.4 image for Text-Embedding-Inference") + LOGGER.info("\t+ Using CPU image version 1.4 for Text-Embedding-Inference (before onnx backend)") self.image = "ghcr.io/huggingface/text-embeddings-inference:cpu-1.4" if is_nvidia_system() and "cpu" in self.image: diff --git a/py_txi/text_generation_inference.py b/py_txi/text_generation_inference.py index f3985ff..602246c 100644 --- a/py_txi/text_generation_inference.py +++ b/py_txi/text_generation_inference.py @@ -32,14 +32,14 @@ def __post_init__(self) -> None: if self.image is None: if is_nvidia_system() and self.gpus is not None: - LOGGER.info("\t+ Using latest NVIDIA GPU image for Text-Generation-Inference") + LOGGER.info("\t+ Using latest NVIDIA CUDA GPU image for Text-Generation-Inference") self.image = "ghcr.io/huggingface/text-generation-inference:latest" elif is_rocm_system() and self.devices is not None: - LOGGER.info("\t+ Using latest ROCm AMD GPU image for Text-Generation-Inference") + LOGGER.info("\t+ Using latest AMD ROCm GPU image for Text-Generation-Inference") self.image = "ghcr.io/huggingface/text-generation-inference:latest-rocm" else: - LOGGER.info("\t+ Using version 1.4 image for Text-Generation-Inference (last image with CPU support)") - self.image = "ghcr.io/huggingface/text-generation-inference:1.4" + LOGGER.info("\t+ Using latest image for Text-Generation-Inference") + self.image = "ghcr.io/huggingface/text-generation-inference:latest" if is_rocm_system() and "rocm" not in self.image: LOGGER.warning("\t+ You are running on a ROCm AMD GPU system but using a non-ROCM image.") From 5b9beb4740933cf1be2defcb57626e8be2996cc5 Mon Sep 17 00:00:00 2001 From: IlyasMoutawwakil Date: Wed, 4 Sep 2024 10:50:26 +0200 Subject: [PATCH 3/3] update --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index afab5ed..dab625a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -17,10 +17,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.10"