From 755c9e447f16437e5afb274fbbad0ac27aa85ee6 Mon Sep 17 00:00:00 2001 From: RaulFD-creator Date: Fri, 30 Jan 2026 10:46:10 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Check=20comptabilit?= =?UTF-8?q?y=20of=20transformers=20with=20molformer=20+=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autopeptideml/reps/lms.py | 5 ++++- tests/test_reps.py | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/autopeptideml/reps/lms.py b/autopeptideml/reps/lms.py index ee9b2a5..8bf9abe 100644 --- a/autopeptideml/reps/lms.py +++ b/autopeptideml/reps/lms.py @@ -4,9 +4,11 @@ os.environ['TOKENIZERS_PARALLELISM'] = 'False' import numpy as np +from packaging.version import parse as V import torch import transformers from transformers import AutoModel, AutoTokenizer, T5Tokenizer, T5EncoderModel + from typing import * from .engine import RepEngineBase @@ -200,7 +202,8 @@ def _load_model(self, model: str): elif 'ankh' in model.lower(): self.lab = 'ElnaggarLab' elif 'molformer' in model.lower(): - print("Warning: Molformer does not support transformers>=5.0.0, we recommend using an earlier version, e.g., transformers==4.41.2") + if V(transformers.__version__) >= V('5.0.0'): + print("Warning: Molformer does not support transformers>=5.0.0, we recommend using an earlier version, e.g., transformers==4.41.2") self.lab = 'ibm' elif 'chemberta' in model.lower(): self.lab = 'DeepChem' diff --git a/tests/test_reps.py b/tests/test_reps.py index d263045..0bab611 100644 --- a/tests/test_reps.py +++ b/tests/test_reps.py @@ -53,6 +53,13 @@ def test_rostlab_family(): assert np.array(a).shape == (1, re.dim()) +def test_molformer_family(): + re = RepEngineLM('molformer-xl') + a = re.compute_reps(['C[C@H](N)C(=O)N[C@@H](CCCNC(=N)N)C(=O)N[C@H]'], batch_size=12) + assert re.dim() == 768 + assert np.array(a).shape == (1, re.dim()) + + if __name__ == '__main__': test_esm_family() print('ESM OK') From 43913e83b0c4820e9d0be2b2580a0ebccf8f0cf8 Mon Sep 17 00:00:00 2001 From: RaulFD-creator Date: Fri, 30 Jan 2026 11:30:22 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=A4=96=20Update=20install=20instructi?= =?UTF-8?q?ons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/python-package.yml | 48 ++++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e7df7e1..4804cfe 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -5,13 +5,12 @@ name: Python package on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: build: - runs-on: ubuntu-latest strategy: fail-fast: false @@ -19,24 +18,25 @@ jobs: python-version: ["3.9", "3.11", "3.13"] steps: - - uses: actions/checkout@v6 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install flake8 pytest sentencepiece rdkit - python -m pip install git+https://github.com/novonordisk-research/pepfunn.git - python -m pip install . - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest + - uses: actions/checkout@v6 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install uv + uv pip install flake8 pytest sentencepiece rdkit --system + uv pip install git+https://github.com/novonordisk-research/pepfunn.git --system + uv pip install . "transformers<5" --system + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From ff31355d2dbec31576e0874ce7e29b862061a946 Mon Sep 17 00:00:00 2001 From: RaulFD-creator Date: Fri, 30 Jan 2026 11:32:33 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=A4=96=20Update=20Python=20versions?= =?UTF-8?q?=20to=20test=20for?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 4804cfe..622cb32 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.11", "3.13"] + python-version: ["3.10", "3.12", "3.13"] steps: - uses: actions/checkout@v6