Skip to content

Comments

Update ASR services setup with new dependencies and configuration#198

Merged
AnkushMalaker merged 1 commit intomainfrom
feature/asr-services-setup
Dec 18, 2025
Merged

Update ASR services setup with new dependencies and configuration#198
AnkushMalaker merged 1 commit intomainfrom
feature/asr-services-setup

Conversation

@AnkushMalaker
Copy link
Collaborator

@AnkushMalaker AnkushMalaker commented Dec 17, 2025

  • Consolidated dependencies into a single setup-requirements.txt for Friend-Lite setup scripts.
  • Updated command paths in wizard.py to reference the new location of setup-requirements.txt.
  • Added support for PYTORCH_CUDA_VERSION in asr-services to enhance compatibility.
  • Introduced init.py for interactive configuration of the ASR service.
  • Removed outdated setup-requirements.txt files from advanced and speaker-recognition services.
  • Updated docker-compose.yml files to use the new PYTORCH_CUDA_VERSION variable.

Summary by CodeRabbit

  • New Features

    • Added interactive setup wizard for ASR (Automatic Speech Recognition) services with system CUDA detection and configuration.
  • Chores

    • Updated default PyTorch CUDA version from cu121 to cu126.
    • Reorganized setup dependencies across services for improved maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

- Consolidated dependencies into a single setup-requirements.txt for Friend-Lite setup scripts.
- Updated command paths in wizard.py to reference the new location of setup-requirements.txt.
- Added support for PYTORCH_CUDA_VERSION in asr-services to enhance compatibility.
- Introduced init.py for interactive configuration of the ASR service.
- Removed outdated setup-requirements.txt files from advanced and speaker-recognition services.
- Updated docker-compose.yml files to use the new PYTORCH_CUDA_VERSION variable.
@AnkushMalaker AnkushMalaker marked this pull request as ready for review December 17, 2025 23:57
@AnkushMalaker
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

Walkthrough

Consolidates setup dependencies into a single root setup-requirements.txt while introducing a new interactive ASR services initialization script in Python. Renames CUDA build arguments to PYTORCH_CUDA_VERSION, updates Docker configurations with cu126 default, detects system CUDA versions, and adds reusable CUDA configuration sharing between services via the wizard.

Changes

Cohort / File(s) Summary
Setup Requirements Consolidation
backends/advanced/setup-requirements.txt, extras/speaker-recognition/setup-requirements.txt
Removed service-specific setup dependencies (rich, pyyaml, python-dotenv) to consolidate into root setup-requirements.txt.
Root Setup Dependencies
setup-requirements.txt
Updated header comment, added versioned pyyaml dependency, and versioned python-dotenv constraint.
ASR Services Interactive Init
extras/asr-services/init.py
New Python module with ASRServicesSetup class providing Rich-based terminal UI, nvidia-smi CUDA detection, interactive prompts, .env backup/update, and configuration summary.
ASR Services Configuration
extras/asr-services/.env.template, extras/asr-services/pyproject.toml
Added PYTORCH_CUDA_VERSION environment variable template and setuptools configuration.
ASR & Speaker Recognition Docker Updates
extras/asr-services/Dockerfile_Parakeet, extras/asr-services/docker-compose.yml, extras/speaker-recognition/docker-compose.yml
Renamed CUDA_VERSION to PYTORCH_CUDA_VERSION, updated default from cu121 to cu126, and aligned uv sync invocations.
Wizard Script Enhancement
wizard.py
Updated service init command paths, added Python init flow for asr-services, introduced PYTORCH_CUDA_VERSION reuse mechanism from speaker-recognition, and extended validation logic.

Sequence Diagram

sequenceDiagram
    actor User
    participant wizard.py
    participant init.py
    participant nvidia-smi
    participant .env System

    User->>wizard.py: Run setup
    wizard.py->>init.py: Invoke ASRServicesSetup.run()
    
    init.py->>init.py: Print header & sections
    
    init.py->>nvidia-smi: Detect system CUDA version
    nvidia-smi-->>init.py: Return CUDA version (or default cu126)
    
    init.py->>User: Display CUDA detection result
    init.py->>User: Interactive prompt for CUDA selection<br/>(cu121, cu126, cu128)
    User-->>init.py: Select CUDA version
    
    init.py->>init.py: Map selection to PyTorch version
    
    init.py->>init.py: Back up existing .env
    init.py->>init.py: Copy .env.template → .env
    init.py->>init.py: Update PYTORCH_CUDA_VERSION in .env
    init.py->>init.py: Set file permissions (600)
    
    init.py->>User: Show configuration summary
    init.py->>User: Display next steps & docker-compose commands
    
    init.py-->>wizard.py: Return
    wizard.py-->>User: Setup complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • extras/asr-services/init.py: Most complex file with Rich UI handling, CUDA detection logic, environment file management, and error handling; requires careful review of nvidia-smi parsing, env backup/restore flow, and choice validation.
  • wizard.py: Multiple logic additions including PYTORCH_CUDA_VERSION reuse mechanism (speaker-recognition → asr-services), new validation conditions, and updated service init paths; cross-service dependencies need verification.
  • Docker configuration consistency: Verify PYTORCH_CUDA_VERSION naming and cu126 default alignment across Dockerfile_Parakeet, docker-compose files, and .env.template.

Possibly related PRs

  • chronicler-ai/chronicle#134: Modifies ASR/speaker-recognition setup and introduces PYTORCH_CUDA_VERSION naming with CUDA-detection helpers.
  • chronicler-ai/chronicle#131: Updates init/setup system across wizard.py, service init scripts, and setup-requirements coordination.
  • chronicler-ai/chronicle#129: Modifies wizard.py service init invocation patterns and .env value handling for services.

Suggested reviewers

  • thestumonkey

Poem

🐰 Whiskers twitching with delight...
A wizard now speaks with setup light,
CUDA versions dance and align,
Rich prompts guide the setup design—
From ASR songs to speaker-voice divine! 🎵

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main objective of the pull request—updating ASR services setup with new dependencies and configuration changes, which aligns with the substantial refactoring of setup dependencies, CUDA versioning, and initialization scripts across multiple service files.
Docstring Coverage ✅ Passed Docstring coverage is 94.12% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/asr-services-setup

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
wizard.py (1)

426-428: Remove extraneous f-string prefixes.

These strings have no placeholders, so the f prefix is unnecessary. Per Ruff F541.

-    console.print(f"[dim]   cd backends/advanced && uv run --with-requirements ../../setup-requirements.txt python init.py[/dim]")
-    console.print(f"[dim]   cd extras/speaker-recognition && uv run --with-requirements ../../setup-requirements.txt python init.py[/dim]")
-    console.print(f"[dim]   cd extras/asr-services && uv run --with-requirements ../../setup-requirements.txt python init.py[/dim]")
+    console.print("[dim]   cd backends/advanced && uv run --with-requirements ../../setup-requirements.txt python init.py[/dim]")
+    console.print("[dim]   cd extras/speaker-recognition && uv run --with-requirements ../../setup-requirements.txt python init.py[/dim]")
+    console.print("[dim]   cd extras/asr-services && uv run --with-requirements ../../setup-requirements.txt python init.py[/dim]")
extras/asr-services/init.py (3)

92-128: Move re import to top of file and fix string version comparison.

Two issues:

  1. Per coding guidelines, the import re on line 113 should be at the top of the file.

  2. The string comparison cuda_ver >= "12.8" is fragile. String comparison works lexicographically, so "9.0" >= "12.1" would incorrectly evaluate to True. While current CUDA versions happen to work, this could break with future versions.

Add at top of file:

import re

And consider using tuple comparison for robustness:

                     if match:
                         major, minor = match.groups()
-                        cuda_ver = f"{major}.{minor}"
-
-                        # Map to available PyTorch CUDA versions
-                        if cuda_ver >= "12.8":
-                            return "cu128"
-                        elif cuda_ver >= "12.6":
-                            return "cu126"
-                        elif cuda_ver >= "12.1":
-                            return "cu121"
+                        cuda_ver = (int(major), int(minor))
+                        
+                        # Map to available PyTorch CUDA versions
+                        if cuda_ver >= (12, 8):
+                            return "cu128"
+                        elif cuda_ver >= (12, 6):
+                            return "cu126"
+                        elif cuda_ver >= (12, 1):
+                            return "cu121"

126-128: Avoid silent failure; consider logging or warning the user.

Per coding guidelines, errors should not be silently ignored. The bare pass hides potential issues. Consider at minimum logging a debug message or informing the user that CUDA detection failed.

-        except (subprocess.SubprocessError, FileNotFoundError):
-            pass
+        except (subprocess.SubprocessError, FileNotFoundError) as e:
+            self.console.print(f"[dim]Could not detect CUDA version: {e}. Using default.[/dim]")
         return "cu126"  # Default fallback to cu126

249-251: Improve exception handling: avoid bare Exception and use proper logging.

Per coding guidelines, always raise errors explicitly rather than silently failing. Per retrieved learnings, prefer logging.exception() inside except blocks to capture the full stack trace, and chain exceptions with raise ... from e when re-raising.

Since this is a top-level handler that exits, consider logging the full traceback for debugging:

+import logging
+
+logger = logging.getLogger(__name__)

Then update the exception handler:

         except Exception as e:
-            self.console.print(f"[red][ERROR][/red] Setup failed: {e}")
+            logger.exception("Setup failed")
+            self.console.print(f"[red][ERROR][/red] Setup failed: {e}")
             sys.exit(1)

Alternatively, if you want to keep it simple without adding logging infrastructure, at least use import traceback and print the traceback for debugging:

         except Exception as e:
+            import traceback
+            traceback.print_exc()
             self.console.print(f"[red][ERROR][/red] Setup failed: {e}")
             sys.exit(1)

Based on learnings, this improves debuggability.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab506dc and 0d3d9ce.

⛔ Files ignored due to path filters (1)
  • extras/asr-services/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • backends/advanced/setup-requirements.txt (0 hunks)
  • extras/asr-services/.env.template (1 hunks)
  • extras/asr-services/Dockerfile_Parakeet (2 hunks)
  • extras/asr-services/docker-compose.yml (1 hunks)
  • extras/asr-services/init.py (1 hunks)
  • extras/asr-services/pyproject.toml (1 hunks)
  • extras/speaker-recognition/docker-compose.yml (1 hunks)
  • extras/speaker-recognition/setup-requirements.txt (0 hunks)
  • setup-requirements.txt (1 hunks)
  • wizard.py (4 hunks)
💤 Files with no reviewable changes (2)
  • backends/advanced/setup-requirements.txt
  • extras/speaker-recognition/setup-requirements.txt
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.py: Use Black formatter with 100-character line length for Python code
Use isort for import sorting in Python code
ALL imports must be at the top of the file after the docstring. NEVER import modules in the middle of functions or files. Use lazy imports sparingly and only when absolutely necessary for circular import issues.
Group imports in order: standard library, third-party, local imports
Always raise errors, never silently ignore. Use explicit error handling with proper exceptions rather than silent failures.
Do not add defensive hasattr() checks. Research and understand input/response or class structure instead.
Use uv run python or uv run python3 instead of direct python or python3 commands for Python execution

Files:

  • extras/asr-services/init.py
  • wizard.py
**/docker-compose*.{yml,yaml}

📄 CodeRabbit inference engine (CLAUDE.md)

Check if src/ is volume mounted. If not, run docker compose build so that code changes are reflected. Do not simply run docker compose restart as it will not rebuild the image.

Files:

  • extras/asr-services/docker-compose.yml
  • extras/speaker-recognition/docker-compose.yml
🧠 Learnings (1)
📚 Learning: 2025-12-08T23:52:34.959Z
Learnt from: AnkushMalaker
Repo: chronicler-ai/chronicle PR: 178
File: backends/advanced/src/advanced_omi_backend/services/memory/providers/mycelia.py:218-223
Timestamp: 2025-12-08T23:52:34.959Z
Learning: In Python code (chronicle project), prefer logging.exception() inside except blocks to automatically log the full stack trace. When re-raising exceptions, always chain with 'raise ... from e' to preserve the original context; use 'raise ... from None' only if you explicitly want to suppress the context. This improves debuggability across Python files.

Applied to files:

  • extras/asr-services/init.py
  • wizard.py
🪛 Ruff (0.14.8)
extras/asr-services/init.py

96-96: Starting a process with a partial executable path

(S607)


104-104: Starting a process with a partial executable path

(S607)


249-249: Do not catch blind exception: Exception

(BLE001)

wizard.py

426-426: f-string without any placeholders

Remove extraneous f prefix

(F541)


427-427: f-string without any placeholders

Remove extraneous f prefix

(F541)


428-428: f-string without any placeholders

Remove extraneous f prefix

(F541)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: speaker-recognition-tests
🔇 Additional comments (13)
extras/speaker-recognition/docker-compose.yml (1)

49-49: No issues identified. PyTorch cu126 is officially supported and available as a valid build configuration. The src/ directory is properly volume-mounted, ensuring code changes are reflected without requiring a rebuild.

extras/asr-services/pyproject.toml (1)

108-111: LGTM!

The explicit packages = [] declaration correctly indicates this project contains only standalone scripts with no installable packages. This prevents setuptools from auto-discovering packages and is a good practice for script-only projects.

extras/asr-services/.env.template (1)

4-7: LGTM!

Clear documentation for the PYTORCH_CUDA_VERSION variable with appropriate options and guidance for users to verify their system's CUDA version.

setup-requirements.txt (1)

1-5: LGTM!

Good consolidation of setup dependencies with appropriate version constraints. The centralized requirements file simplifies dependency management across multiple service init scripts.

extras/asr-services/Dockerfile_Parakeet (1)

6-7: LGTM!

The rename from CUDA_VERSION to PYTORCH_CUDA_VERSION is more descriptive and aligns with the docker-compose and .env.template. The build argument is correctly used in the uv sync command.

Also applies to: 19-20

extras/asr-services/docker-compose.yml (2)

7-7: LGTM!

The rename to PYTORCH_CUDA_VERSION with default cu126 is consistent with related configuration files.


11-15: Note: Code changes require rebuild.

As per the coding guidelines, since src/ is not volume-mounted, code changes require running docker compose build to be reflected. The current ./model_cache, ./debug, and ./results mounts are appropriate for persistent data, but application code is baked into the image at build time.

wizard.py (3)

58-71: LGTM!

The command paths are correctly updated to reference the centralized ../../setup-requirements.txt, which aligns with the consolidation of dependencies for all service init scripts.


89-89: LGTM!

Adding asr-services to the Python-init-service check ensures proper validation of init.py existence for the new ASR services setup.


218-224: LGTM!

Good UX improvement to reuse PYTORCH_CUDA_VERSION from an existing speaker-recognition configuration, avoiding redundant user prompts when both services are configured together.

extras/asr-services/init.py (3)

1-22: LGTM!

Imports are correctly organized at the top of the file with standard library, then third-party packages.


203-222: LGTM!

The summary and next steps provide clear, actionable guidance for users after configuration.


254-264: LGTM!

Clean CLI entry point with appropriate argument parsing for the --pytorch-cuda-version option.

@AnkushMalaker AnkushMalaker merged commit 4178235 into main Dec 18, 2025
5 checks passed
@AnkushMalaker AnkushMalaker deleted the feature/asr-services-setup branch December 18, 2025 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants