Skip to content

Commit

Permalink
Merge pull request #77 from sensein/release_040
Browse files Browse the repository at this point in the history
Release 040
  • Loading branch information
fabiocat93 committed Jun 21, 2024
2 parents d68cedf + 2cd5f15 commit 27e11e9
Show file tree
Hide file tree
Showing 64 changed files with 1,459 additions and 669 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ body:
description: Please, provide a clear and concise piece of information.
placeholder: Please, provide a clear and concise piece of information.
validations:
required: false
required: false
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Include any relevant screenshots.
## Checklist:
- [ ] My code follows the code style of this project.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] All new and existing tests passed.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/basic.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Basic Pull Request Template

## Description
Briefly describe the changes you've made.
Briefly describe the changes you've made.
34 changes: 17 additions & 17 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
version: 2
updates:
# Configuration for Python package updates using pip
- package-ecosystem: pip
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 5
groups:
production-dependencies:
dependency-type: production
development-dependencies:
dependency-type: development
- package-ecosystem: pip
directory: /
schedule:
interval: monthly
open-pull-requests-limit: 5
groups:
production-dependencies:
dependency-type: production
development-dependencies:
dependency-type: development

# Configuration for GitHub Actions updates
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 5
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
open-pull-requests-limit: 5

# Enable automatic security updates
security_updates: true
security_updates: true
16 changes: 8 additions & 8 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
python-version: ['3.10']
include:
- os: ubuntu-latest
python-version: "3.10"
deploy: true # Only deploy from this configuration
- os: ubuntu-latest
python-version: '3.10'
deploy: true # Only deploy from this configuration
outputs:
deploy: ${{ steps.set-deploy-output.outputs.deploy }}
steps:
Expand Down Expand Up @@ -59,11 +59,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest] # For demonstration, other OSes are commented out
python-version: ["3.10"]
python-version: ['3.10']
include:
- os: ubuntu-latest
python-version: "3.10"
deploy: true # Only deploy from this configuration
- os: ubuntu-latest
python-version: '3.10'
deploy: true # Only deploy from this configuration
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -41,7 +41,3 @@ jobs:
POETRY_REQUESTS_TIMEOUT: 120
run: poetry publish
shell: bash




47 changes: 23 additions & 24 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Auto-release
on:
push:
branches:
- main
- main

env:
AUTO_VERSION: v11.1.2
Expand All @@ -13,31 +13,30 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Prepare repository
- name: Prepare repository
# Fetch full git history and tags
run: git fetch --unshallow --tags
run: git fetch --unshallow --tags

- name: Unset header
- name: Unset header
# checkout@v2 adds a header that makes branch protection report errors
# because the Github action bot is not a collaborator on the repo
run: git config --local --unset http.https://github.com/.extraheader

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Download auto
run: |
auto_download_url="$(curl -fsSL https://api.github.com/repos/intuit/auto/releases/tags/$AUTO_VERSION | jq -r '.assets[] | select(.name == "auto-linux.gz") | .browser_download_url')"
wget -O- "$auto_download_url" | gunzip > ~/auto
chmod a+x ~/auto
- name: Create release
run: |
~/auto shipit -vv
env:
GH_TOKEN: ${{ secrets.AUTO_ORG_TOKEN }}

run: git config --local --unset http.https://github.com/.extraheader

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Download auto
run: |
auto_download_url="$(curl -fsSL https://api.github.com/repos/intuit/auto/releases/tags/$AUTO_VERSION | jq -r '.assets[] | select(.name == "auto-linux.gz") | .browser_download_url')"
wget -O- "$auto_download_url" | gunzip > ~/auto
chmod a+x ~/auto
- name: Create release
run: |
~/auto shipit -vv
env:
GH_TOKEN: ${{ secrets.AUTO_ORG_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,7 @@ cython_debug/
.idea/

data/

# Speechbrain models
pretrained_models
src/tests/audio/tasks/pretrained_models/
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ repos:
args: [--ignore-missing-imports]
additional_dependencies:
- pydantic>=1.10.4
- types-requests
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions ACTION_PLAN.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Action Plan for Senselab

Senselab is a Python package designed to streamline the processing and analysis of behavioral data, including voice and speech, text, and video. Our goal is to implement robust and reproducible methodologies.
Senselab is a Python package designed to streamline the processing and analysis of behavioral data, including voice and speech, text, and video. Our goal is to implement robust and reproducible methodologies.

This action plan outlines our initial functionalities and integrations for Senselab. As we progress, we will continue to enhance and expand these capabilities to support more advanced and comprehensive behavioral data analysis.
Anyone should feel free to suggest more features and methods.
Anyone should feel free to suggest more features and methods.

For an updated project progress, please see the [Project Board](https://github.com/orgs/sensein/projects/45).

Expand Down
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Note that a code of conduct applies to all spaces managed by the `senselab` proj
Please use the following workflow when contributing:

0. **Install poetry and poetry-dynamic-versioning plugin for dynamic versioning**:
- ```pipx install poetry```
- ```pipx install poetry==1.7.1```
- ```pipx inject poetry "poetry-dynamic-versioning[plugin]"```
1. **Create an issue**: Use GitHub to create an issuel, assign it to yourself (and any collaborators) and, if you have access, add it to the [Project board](https://github.com/orgs/sensein/projects/45).
2. **Create a branch**: Use GitHub's "Create a branch" button from the issue page to generate a branch associated with the issue.
Expand All @@ -17,7 +17,8 @@ Please use the following workflow when contributing:
- ```git fetch origin```
- ```git checkout <branch-name>```
5. **Install all required dependencies**:
```poetry install --with dev,docs```
- ```poetry run pip install iso-639```
- ```poetry install --with dev,docs```
6. **Install pre-commit hooks**:
```poetry run pre-commit install```
7. **Work locally on the issue branch.**
Expand Down
17 changes: 8 additions & 9 deletions FEATURES.tmp.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Functionalities
This file is here just as a support for development.
# Functionalities
This file is here just as a support for development.

AUDIO

[TODO]:
[TODO]:
- speech to text
1. to transcribe speech into text
- INPUT:
- INPUT:
1. a datasets object with the audio recordings in the "audio" column
2. the audio column (default = "audio")
3. the speech to text service to use (including the name, the version, the revision, and - for some services only and sometimes it's optional - the language of the transcription model we want to use)
Expand All @@ -15,7 +15,7 @@ AUDIO
2. organize the dataset into batches
- PROCESSING:
1. transcribe the dataset
- POSTPROCESSING:
- POSTPROCESSING:
1. formatting the transcripts to follow a standard organization
- OUTPUT:
1. a new dataset including only the transcripts of the audios in a standardized json format (plus an index?)
Expand All @@ -25,14 +25,13 @@ AUDIO
3. test the language is supported (and the tool handles errors)

2. to compute word error rate
- INPUT:
1. a dataset object with the "transcript" and the "groundtruth" columns
- INPUT:
1. a dataset object with the "transcript" and the "groundtruth" columns
2. a service with a name (default is jitter)
- PROCESSING:
1. computing the per-row WER between the 2 columns
- OUTPUT:
- OUTPUT:
1. a dataset with the "WER" column
- TESTS:
1. test input errors (a field is missing, fields missing, the 2 columns don't contain strings)
2. test output is ok

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ torch-audiomentations = "^0.11.1"
sentence-transformers = "^2.7.0"
jiwer = "^3.0.4"
speechbrain = "^1.0.0"
pyav = "^12.1.0"
pyannote-audio = "^3.2.0"
pycountry = "^24.6.1"
types-requests = "^2.32"
Expand Down Expand Up @@ -149,7 +150,7 @@ skip = [
"poetry.lock",
"docs_style/pdoc-theme/syntax-highlighting.css"
]
ignore-words-list = ["senselab", "nd", "astroid", "wil"]
ignore-words-list = ["senselab", "nd", "astroid", "wil", "SER"]

[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
Expand Down
20 changes: 18 additions & 2 deletions src/senselab/audio/data_structures/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ease of maintaining the codebase and offering consistent public APIs.
"""

import os
import uuid
from typing import Dict, List, Optional, Tuple, Union

Expand Down Expand Up @@ -35,7 +36,7 @@ class Audio(BaseModel):

waveform: torch.Tensor
sampling_rate: int
orig_path_or_id: Optional[str] = Field(default_factory=lambda: str(uuid.uuid4()))
orig_path_or_id: Optional[str] = None
metadata: Dict = Field(default={})
model_config = {"arbitrary_types_allowed": True}

Expand All @@ -57,7 +58,7 @@ def convert_to_tensor(
if len(temporary_tensor.shape) == 1:
# make the audio data [channels=1, samples]
temporary_tensor = temporary_tensor.unsqueeze(0)
return temporary_tensor
return temporary_tensor.to(torch.float32)

@classmethod
def from_filepath(cls, filepath: str, metadata: Dict = {}) -> "Audio":
Expand All @@ -71,6 +72,21 @@ def from_filepath(cls, filepath: str, metadata: Dict = {}) -> "Audio":

return cls(waveform=array, sampling_rate=sampling_rate, orig_path_or_id=filepath, metadata=metadata)

def generate_path(self) -> str:
"""Generate a path like string for this Audio.
Generates a path like string for the Audio by either utilizing the orig_path_or_id, checking
if it is a path (has an extension), otherwise using the id if orig_path_or_id is not an ID
and giving an extension and relative to the current directory.
"""
if self.orig_path_or_id:
if os.path.splitext(self.orig_path_or_id)[-1].lower():
return self.orig_path_or_id
else:
return f"{self.orig_path_or_id}"
else:
return f"{self.id()}"

def id(self) -> str:
"""Generate a unique identifier for the Audio.
Expand Down
1 change: 1 addition & 0 deletions src/senselab/audio/tasks/classification/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""This module defines the APIs for doing generalized audio classification tasks."""
Loading

0 comments on commit 27e11e9

Please sign in to comment.