|
Download docs/INTEGRATION_ARCHITECTURE.md from Norelad/TraductAL: direct link, hf CLI and curl.
- Browser
- Download file 17.4 kB
-
https://huggingface.co/spaces/Norelad/TraductAL/resolve/main/docs/INTEGRATION_ARCHITECTURE.md
- Command line
-
hf download hf://spaces/Norelad/TraductAL/docs/INTEGRATION_ARCHITECTURE.md
-
curl -L -o INTEGRATION_ARCHITECTURE.md https://huggingface.co/spaces/Norelad/TraductAL/resolve/main/docs/INTEGRATION_ARCHITECTURE.md
17.4 kB
| # ποΈ Swiss French Integration Architecture | |
| ## Current TraductAL Architecture | |
| ``` | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β TraductAL Engine β | |
| β β | |
| β ββββββββββββββββββββ βββββββββββββββββββββββββββ β | |
| β β Apertus-8B β β Apertus-8B β β | |
| β β (1,811 langs) β β (1,811 langs) β β | |
| β β βββββββββββββ β β βββββββββββββββββββββ β β | |
| β β β Mainstreamβ β β β Romansh (6 vars) β β β | |
| β β β pairs ββββΌβββsameβββββββΌββββ€ Low-resource β β β | |
| β β β β β β β specialist β β β | |
| β β βββββββββββββ β β βββββββββββββββββββββ β β | |
| β ββββββββββββββββββββ βββββββββββββββββββββββββββ β | |
| β β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β β | |
| βΌ βΌ | |
| βββββββββββ ββββββββββββββββ | |
| β Whisper β β MMS-TTS β | |
| β STT β β (9 langs) β | |
| β99 langs β β No Romansh β | |
| βββββββββββ ββββββββββββββββ | |
| β β | |
| ββββββββββββββββββ¬ββββββββββββββββββββββββββββ | |
| βΌ | |
| βββββββββββββββββ | |
| β Multimodal β | |
| β Translation β | |
| βββββββββββββββββ | |
| ``` | |
| --- | |
| ## After Swiss French Integration | |
| ``` | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β Enhanced TraductAL Engine β | |
| β β | |
| β ββββββββββββββββββββ βββββββββββββββββββββββββββ β | |
| β β Apertus-8B β β Apertus-8B (Enhanced) β β | |
| β β (1,811 langs) β β (1,811 + dialects) β β | |
| β β β β β β | |
| β β Common pairs βββββ same βββββΌβββ€ ββββββββββββββββββββ β β | |
| β β (enβde, etc) β β β β Romansh (6 vars) β β β | |
| β β β β ββββββββββββββββββββ β β | |
| β ββββββββββββββββββββ β ββββββββββββββββββββ β β | |
| β β β Swiss French β¨ β β β | |
| β β β β’ Vaud β β β | |
| β β β β’ Geneva β β β | |
| β β β β’ Fribourg β β β | |
| β β β β’ Valais β β β | |
| β β β β’ NeuchΓ’tel β β β | |
| β β β β’ Jura β β β | |
| β β ββββββββββββββββββββ β β | |
| β βββββββββββββββββββββββββββ β | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| ``` | |
| --- | |
| ## Modality Flow Diagrams | |
| ### **Text Translation** β Full Support | |
| ``` | |
| Input Text (any language) | |
| β | |
| βΌ | |
| ββββββββββββββββ | |
| β Detect β | |
| β Swiss French?β | |
| ββββββββ¬ββββββββ | |
| β | |
| Yes β No | |
| βββββββ΄ββββββ | |
| βΌ βΌ | |
| ββββββββββββββββββββββββ ββββββββββββββββββββ | |
| β Apertus-8B β β Apertus-8B β | |
| β (Romansh specialist) β β (general mode) β | |
| ββββββββββββ¬ββββββββββββ ββββββββββ¬ββββββββββ | |
| β β | |
| βββββββββββββ¬ββββββββββββ | |
| βΌ | |
| Output Text (any language) | |
| ``` | |
| ### **Speech Translation** β οΈ Partial Support | |
| ``` | |
| Swiss French Audio | |
| β | |
| βΌ | |
| ββββββββββββββββ | |
| β Whisper β β οΈ Transcribes as French | |
| β STT (fr) β May lose dialectal words | |
| ββββββββ¬ββββββββ | |
| β | |
| βΌ | |
| Swiss French Text (approximate) | |
| β | |
| βΌ | |
| ββββββββββββββββ | |
| β Apertus8B β β Understands dialect | |
| β Translation β | |
| ββββββββ¬ββββββββ | |
| β | |
| βΌ | |
| Target Language Text | |
| β | |
| βΌ | |
| ββββββββββββββββ | |
| β MMS-TTS β β Works for target | |
| β (target) β (if not Swiss French) | |
| ββββββββ¬ββββββββ | |
| β | |
| βΌ | |
| Target Audio | |
| ``` | |
| ### **Audio-to-Audio (Full Cycle)** β οΈ | |
| ``` | |
| Source Audio Target Audio | |
| β β² | |
| β β | |
| βΌ β | |
| βββββββββββ ββββββββββββ | |
| β Whisper β β MMS-TTS β | |
| β STT β β β | |
| ββββββ¬βββββ ββββββ¬ββββββ | |
| β β | |
| β β | |
| βΌ β | |
| Text (source) β | |
| β β | |
| βΌ β | |
| ββββββββββββββββ β | |
| β Apertus8B β β | |
| β Translation βββββββββββββββββββββββββββΊβ | |
| ββββββββββββββββ Text (target) | |
| Swiss French Other Languages | |
| Input: β Works Output: β Works | |
| Other Languages Swiss French | |
| Input: β Works Output: β No TTS! | |
| ``` | |
| --- | |
| ## Integration Points | |
| ### **1. Dataset β Model Training** | |
| ``` | |
| Your Glossaries (1861) | |
| β | |
| βΌ | |
| ββββββββββββββββββββ | |
| β DCG Parser β β Built! | |
| β (Prolog) β | |
| ββββββββββ¬ββββββββββ | |
| β | |
| βΌ | |
| CSV Datasets | |
| (2,479 β 30,000) | |
| β | |
| βΌ | |
| ββββββββββββββββββββ | |
| β Fine-tune β | |
| β Apertus8B β β³ Next step | |
| ββββββββββ¬ββββββββββ | |
| β | |
| βΌ | |
| Swiss French | |
| Translation Model | |
| ``` | |
| ### **2. Model β TraductAL** | |
| ``` | |
| Fine-tuned Apertus8B | |
| β | |
| βΌ | |
| βββββββββββββββββββββββββββ | |
| β unified_translator.py β | |
| β + swiss_french_dialects β π Add codes | |
| ββββββββββ¬βββββββββββββββββ | |
| β | |
| βΌ | |
| βββββββββββββββββββββββββββ | |
| β Gradio UI β | |
| β + dialect dropdowns β π¨ Update UI | |
| ββββββββββ¬βββββββββββββββββ | |
| β | |
| βΌ | |
| User Interface | |
| ``` | |
| ### **3. Speech Pipeline** | |
| ``` | |
| Audio Input | |
| β | |
| βΌ | |
| βββββββββββββββ | |
| β Whisper STT β β Already integrated | |
| ββββββββ¬βββββββ | |
| β | |
| βΌ | |
| βββββββββββββββββββ | |
| β Language detect β π Add Swiss French detection | |
| ββββββββ¬βββββββββββ | |
| β | |
| βΌ | |
| βββββββββββββββββββ | |
| β Translation β β Already integrated | |
| ββββββββ¬βββββββββββ | |
| β | |
| βΌ | |
| βββββββββββββββββββ | |
| β TTS synthesis β β οΈ Workaround needed | |
| ββββββββ¬βββββββββββ | |
| β | |
| βΌ | |
| Audio Output | |
| ``` | |
| --- | |
| ## Code Modification Map | |
| ### **Minimal Changes Required** | |
| ``` | |
| unified_translator.py | |
| βββ Add swiss_french_dialects dict [10 lines] | |
| βββ Update _is_dialect() method [5 lines] | |
| βββ Update auto_select_engine() [5 lines] | |
| apertus_translator.py | |
| βββ Add dialect codes to supported_languages [10 lines] | |
| gradio_app.py (or equivalent) | |
| βββ Add Swiss French to COMMON_LANGUAGES [6 lines] | |
| βββ Update dropdown options [3 lines] | |
| βββ Add dialect info tooltips [5 lines] | |
| whisper_stt.py (optional enhancement) | |
| βββ Add post-processing for dialectal words [20 lines] | |
| TOTAL: ~64 lines of code | |
| ``` | |
| --- | |
| ## Comparison Matrix | |
| ### **Romansh (Current) vs Swiss French (Future)** | |
| | Aspect | Romansh | Swiss French | Notes | | |
| |--------|---------|--------------|-------| | |
| | **Apertus8B support** | β Native | β Fine-tuned | Same approach | | |
| | **Dataset size** | 46,092 | 2,479β30,000 | Building up | | |
| | **# Variants** | 6 | 6 | Similar structure | | |
| | **Text translation** | β Works | β Will work | Proven tech | | |
| | **Whisper STT** | β No model | β οΈ Via French | Swiss French advantage! | | |
| | **TTS** | β None | β οΈ Fr-CH* | Both limited | | |
| | **Audio-to-audio** | β οΈ Input only | β οΈ Input only | Same limitation | | |
| *Can use commercial fr-CH (Swiss French accent) APIs | |
| --- | |
| ## Data Flow Example | |
| ### **Real Use Case**: "Translate Vaud speech to English audio" | |
| ``` | |
| 1. Input: vaudois_speech.mp3 | |
| "Bonjour, je vais faire le rΓ©duit avec la panosse" | |
| 2. STT (Whisper, French model): | |
| β "Bonjour, je vais faire le rΓ©duit avec la serpilliΓ¨re" | |
| β οΈ "panosse" β "serpilliΓ¨re" (lost dialect) | |
| 3. Post-process (optional): | |
| β "Bonjour, je vais faire le rΓ©duit avec la panosse" | |
| β Restore from glossary | |
| 4. Translation (Apertus8B, fr-vaud β en): | |
| β "Hello, I'm going to clean with the mop" | |
| β Understands "rΓ©duit" = cleaning, "panosse" = mop | |
| 5. TTS (MMS-TTS, English): | |
| β english_output.mp3 | |
| β Perfect English pronunciation | |
| Result: β Works end-to-end! | |
| ``` | |
| --- | |
| ## Technical Stack | |
| ``` | |
| βββββββββββββββββββββββββββββββββββββββββββ | |
| β Application Layer β | |
| β β’ Gradio UI β | |
| β β’ FastAPI backend β | |
| β β’ File handling β | |
| ββββββββββββββββ¬βββββββββββββββββββββββββββ | |
| β | |
| ββββββββββββββββ΄βββββββββββββββββββββββββββ | |
| β Translation Layer β | |
| β β’ unified_translator.py β | |
| β β’ Auto engine selection β | |
| β β’ Language detection β | |
| ββββββββββββββββ¬βββββββββββββββββββββββββββ | |
| β | |
| ββββββββ΄βββββββ | |
| β β | |
| ββββββββββββββββββββββββββββββββ | |
| β Apertus-8B (Fine-tuned) β | |
| β ββββββββββββββββββββββββ β | |
| β β Romansh β β | |
| β β Swiss French β β | |
| β β 1,811 languages β β | |
| β ββββββββββββββββββββββββ β | |
| ββββββββββββββββββββββββββββββββ | |
| βββββββββββββββββββββββββββββββββββββββββββ | |
| β Speech Layer β | |
| β β’ Whisper (STT) β | |
| β β’ MMS-TTS (TTS) β | |
| β β’ Audio processing β | |
| βββββββββββββββββββββββββββββββββββββββββββ | |
| βββββββββββββββββββββββββββββββββββββββββββ | |
| β Data Layer β | |
| β β’ Swiss French datasets β | |
| β β’ Training data β | |
| β β’ Glossaries β | |
| βββββββββββββββββββββββββββββββββββββββββββ | |
| ``` | |
| --- | |
| ## Timeline Gantt Chart | |
| ``` | |
| Month 1-3: Dataset Collection | |
| [ββββββββββββββββββββββββββββββββββββ] 100% | |
| ββ Vaud: ββββββββββββββββββββ 48% | |
| ββ Geneva: ββββββββββββββββββββ 0% (finding) | |
| ββ Fribourg: ββββββββββββββββββββ 0% (finding) | |
| ββ Others: ββββββββββββββββββββ 0% (finding) | |
| Month 3-4: Model Training | |
| [ββββββββββββββββββββββββββββββββ] 0% | |
| ββ Fine-tune Apertus8B on 30K examples | |
| Month 4: Integration | |
| [ββββββββββββββββββββββββββββββββ] 0% | |
| ββ Update unified_translator | |
| ββ Update UI | |
| ββ Test all modalities | |
| Month 5-6: Production | |
| [ββββββββββββββββββββββββββββββββ] 0% | |
| ββ Deploy | |
| ββ Document | |
| ββ Iterate | |
| ``` | |
| --- | |
| ## Success Criteria | |
| ### **MVP (Minimum Viable Product)** | |
| - β Text translation: Swiss French β 5+ languages | |
| - β Quality: 70%+ accuracy on test set | |
| - β Speed: <5s per sentence (CPU) | |
| - β UI: Integrated into TraductAL Gradio | |
| ### **Production Ready** | |
| - β Text translation: All 6 dialects | |
| - β Quality: 85%+ accuracy | |
| - β Speech translation: Input working | |
| - β Documentation: Complete user guide | |
| - β Testing: 100 real-world examples validated | |
| ### **Research Complete** | |
| - β Dataset: 100K+ examples (all dialects) | |
| - β Publication: Paper on low-resource dialect NLP | |
| - β TTS: Custom model or commercial integration | |
| - β STT: Fine-tuned Whisper for Swiss French | |
| --- | |
| ## Summary | |
| **Architecture is ready** β | |
| - Proven with Romansh | |
| - Minimal code changes needed | |
| - All infrastructure in place | |
| **Datasets in progress** β³ | |
| - 2,479 / 30,000 (8.3%) | |
| - DCG parser working | |
| - Pipeline established | |
| **Integration straightforward** β | |
| - Same approach as Romansh | |
| - ~100 lines of code | |
| - 1-2 weeks development | |
| **TTS is the only gap** β οΈ | |
| - Not unique to Swiss French (Romansh same) | |
| - Workarounds available | |
| - Optional long-term solution | |
| **Your Swiss French datasets will integrate seamlessly into TraductAL!** π¨ππ | |