From b300ec6333ffbfeeeb721a1437876e289f698a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Can=C3=A9vet?= Date: Thu, 12 Sep 2024 15:00:21 +0200 Subject: [PATCH 01/10] chore: Add jax optional deps --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f3f321a..57e8fdb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,9 @@ torch = [ tensorflow = [ "tensorflow[and-cuda]", ] +jax = [ + "jax[cuda12]", +] dev = [ "pre-commit", ] From 9d8b8348da57677628d370845702174e1ffd819c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Can=C3=A9vet?= Date: Thu, 12 Sep 2024 15:01:03 +0200 Subject: [PATCH 02/10] docs: Update documentation with Jax part --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9eab828..b719e53 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,12 @@ To install Keras 3 with TensorFlow backend, run: conda env create -f conda/rsclf-tensorflow.yaml ``` +To install Keras 3 with Jax backend, run: + +```bash +conda env create -f conda/rsclf-jax.yaml +``` + Then install the package in that environment (the default name is `rsclf`) with: ```bash @@ -49,6 +55,12 @@ or pip install raw-speech-classification[tensorflow] ``` +or + +```bash +pip install raw-speech-classification[jax] +``` + You'll also need to set the `KERAS_BACKEND` environment variable to the correct backend before running `rsclf-train` or `rsclf-test` (see below), or globally for the current bash session with: @@ -57,7 +69,14 @@ bash session with: export KERAS_BACKEND=torch ``` -Replace `torch` by `tensorflow` accordingly. +Replace `torch` by `tensorflow` or `jax` accordingly. + +If you already have an environment with PyTorch, TensorFlow, or Jax +installed, you can simply run: + +```bash +pip install raw-speech-classification +``` ## Using the code From c7c91788d5ed15e442eb6a76733897ccca88258c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Can=C3=A9vet?= Date: Thu, 12 Sep 2024 15:03:06 +0200 Subject: [PATCH 03/10] chore: Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f01bb78..0812d67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ SPDX-License-Identifier: GPL-3.0-only # Changelog +## September 2024 + +- Add Jax backend +- Make pip installable package on PyPi + ## August 2024 - Update the code for Keras 3 with PyTorch or Tensorflow backend From a4ef7905a3fec7513bb6640072e76ec398b0b30a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Can=C3=A9vet?= Date: Thu, 12 Sep 2024 15:03:52 +0200 Subject: [PATCH 04/10] build: Add conda file for Jax backend --- conda/rsclf-jax.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 conda/rsclf-jax.yaml diff --git a/conda/rsclf-jax.yaml b/conda/rsclf-jax.yaml new file mode 100644 index 0000000..8416ea1 --- /dev/null +++ b/conda/rsclf-jax.yaml @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: Copyright © Idiap Research Institute +# +# SPDX-License-Identifier: GPL-3.0-only + +name: rsclf +dependencies: + - python=3.11 + - pip + - pip: + - keras + - h5py + - scipy + - jax[cuda12] + - matplotlib + - numpy + - polars From 9f6ad765c2bb0a576178423643e047e37c8b1173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Can=C3=A9vet?= Date: Fri, 13 Sep 2024 13:53:33 +0200 Subject: [PATCH 05/10] docs: Proof read documentation --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b719e53..ba6d656 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ the fixed length signals. ## Installation -### From source, In a Conda environment +### From source in a conda environment To install Keras 3 with PyTorch backend, run: @@ -61,7 +61,14 @@ or pip install raw-speech-classification[jax] ``` -You'll also need to set the `KERAS_BACKEND` environment variable to the correct backend +If you already have an environment with PyTorch, TensorFlow, or Jax +installed, you can simply run: + +```bash +pip install raw-speech-classification +``` + +You will also need to set the `KERAS_BACKEND` environment variable to the correct backend before running `rsclf-train` or `rsclf-test` (see below), or globally for the current bash session with: @@ -71,13 +78,6 @@ export KERAS_BACKEND=torch Replace `torch` by `tensorflow` or `jax` accordingly. -If you already have an environment with PyTorch, TensorFlow, or Jax -installed, you can simply run: - -```bash -pip install raw-speech-classification -``` - ## Using the code 1. Create lists for training, cross-validation and testing. From 4a059785d4e40145136344e2ce69ff3fe21afc58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Can=C3=A9vet?= Date: Fri, 13 Sep 2024 13:56:16 +0200 Subject: [PATCH 06/10] docs: Fix language --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba6d656..05e6b41 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Replace `torch` by `tensorflow` or `jax` accordingly. `root` option could be `/home/bob/data/my_dataset` and the content of the files would then be like: - ```txt + ```text part1/file1.wav 1 part1/file2.wav 0 ``` @@ -146,7 +146,7 @@ obtain the following curve in `results/seg-f1/plot.png`: probabilities. If you need the results per speaker, configure it accordingly (see the script for details). The default output format is: - ```txt + ```text