fahimtalking 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ .uv/
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ .pytest_cache/
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+ .coverage
12
+ htmlcov/
13
+ models/**/*.onnx
14
+ models/**/*.bin
15
+ models/**/*.pt
16
+ models/**/*.nemo
17
+ models/**/*.tflite
18
+ .env
19
+ config/local.yaml
20
+ recordings/
21
+ cache/
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.5
2
+ Name: fahimtalking
3
+ Version: 0.1.0
4
+ Summary: Bootstrap installer/launcher for Fahim Talking. Downloads and verifies the real runtime on first run; ships no proprietary code, models, or heavy dependencies.
5
+ Project-URL: Homepage, https://huggingface.co/sallout/fahimtalkingfiles
6
+ Author: Tayseer
7
+ License: Proprietary
8
+ Requires-Python: <3.13,>=3.12
9
+ Provides-Extra: dev
10
+ Requires-Dist: build>=1.2; extra == 'dev'
11
+ Requires-Dist: pytest>=8.0; extra == 'dev'
12
+ Requires-Dist: twine>=5.0; extra == 'dev'
13
+ Description-Content-Type: text/markdown
14
+
15
+ # fahimtalking
16
+
17
+ Lightweight bootstrap/launcher for **Fahim Talking**, published by Tayseer.
18
+
19
+ ```
20
+ py -3.12 -m pip install fahimtalking
21
+ ```
22
+
23
+ This package is intentionally tiny: it contains no proprietary source code,
24
+ no models, and no heavy dependencies (no PyTorch, no CUDA libraries). It
25
+ only knows how to:
26
+
27
+ 1. Securely store a Hugging Face read token (`fahimtalking auth`).
28
+ 2. On first `fahimtalking run`, download the checksum-verified main and TTS
29
+ runtime archives from
30
+ [`sallout/fahimtalkingfiles`](https://huggingface.co/sallout/fahimtalkingfiles)
31
+ using that token, atomically extract them, download any missing Hugging
32
+ Face models into the standard user cache, and start the Admin and
33
+ WebSocket services.
34
+ 3. On every later run, reuse the already-verified runtimes and models
35
+ without downloading anything again.
36
+
37
+ ## Commands
38
+
39
+ ```
40
+ fahimtalking help
41
+ fahimtalking auth Securely store your Hugging Face read token
42
+ fahimtalking doctor Check this machine and report runtime status
43
+ fahimtalking ports Show/change the Admin and WebSocket ports
44
+ fahimtalking run Install missing runtimes/models, then run
45
+ fahimtalking stop Stop the running services
46
+ ```
47
+
48
+ ## Where things live
49
+
50
+ All writable application data (downloaded runtimes, the encrypted token,
51
+ config, run-state) lives under:
52
+
53
+ ```
54
+ C:\Users\<user>\AppData\Local\Tayseer\FahimTalking
55
+ ```
56
+
57
+ Nothing is written to this package's own install location (site-packages);
58
+ uninstalling with `pip uninstall fahimtalking` never touches that data
59
+ directory - remove it by hand if you want a fully clean slate.
60
+
61
+ ## Security notes
62
+
63
+ * The Hugging Face token is only ever stored encrypted at rest via the
64
+ Windows Data Protection API (DPAPI), scoped to your Windows user account
65
+ on this machine. It is never written to a config file, log, or the
66
+ package itself, and never accepted as a command-line argument (so it
67
+ never lands in shell history).
68
+ * The two runtime archives are downloaded from a *fixed* URL
69
+ (`https://huggingface.co/sallout/fahimtalkingfiles/resolve/main`) baked
70
+ into this package at release time, authenticated with your token via an
71
+ `Authorization: Bearer` header, and verified against a bundled SHA-256
72
+ manifest before anything is extracted.
73
+ * The proprietary application code inside the downloaded runtimes is
74
+ compiled (not shipped as plain `.py`) - see this repository's
75
+ `scripts/protect_source.ps1`. Obfuscation/compilation of *code* is not,
76
+ and is never treated as, protection for the token above; that's what
77
+ DPAPI is for.
78
+
79
+ ## For maintainers: building this package
80
+
81
+ See `../../scripts/build_pypi_wheel.ps1` in this repository and the
82
+ packaging runbook for the full release process (rebuilding the protected
83
+ runtime archives, publishing them to Hugging Face, syncing this package's
84
+ bundled manifest, building the wheel, and testing it in a clean virtual
85
+ environment).
@@ -0,0 +1,71 @@
1
+ # fahimtalking
2
+
3
+ Lightweight bootstrap/launcher for **Fahim Talking**, published by Tayseer.
4
+
5
+ ```
6
+ py -3.12 -m pip install fahimtalking
7
+ ```
8
+
9
+ This package is intentionally tiny: it contains no proprietary source code,
10
+ no models, and no heavy dependencies (no PyTorch, no CUDA libraries). It
11
+ only knows how to:
12
+
13
+ 1. Securely store a Hugging Face read token (`fahimtalking auth`).
14
+ 2. On first `fahimtalking run`, download the checksum-verified main and TTS
15
+ runtime archives from
16
+ [`sallout/fahimtalkingfiles`](https://huggingface.co/sallout/fahimtalkingfiles)
17
+ using that token, atomically extract them, download any missing Hugging
18
+ Face models into the standard user cache, and start the Admin and
19
+ WebSocket services.
20
+ 3. On every later run, reuse the already-verified runtimes and models
21
+ without downloading anything again.
22
+
23
+ ## Commands
24
+
25
+ ```
26
+ fahimtalking help
27
+ fahimtalking auth Securely store your Hugging Face read token
28
+ fahimtalking doctor Check this machine and report runtime status
29
+ fahimtalking ports Show/change the Admin and WebSocket ports
30
+ fahimtalking run Install missing runtimes/models, then run
31
+ fahimtalking stop Stop the running services
32
+ ```
33
+
34
+ ## Where things live
35
+
36
+ All writable application data (downloaded runtimes, the encrypted token,
37
+ config, run-state) lives under:
38
+
39
+ ```
40
+ C:\Users\<user>\AppData\Local\Tayseer\FahimTalking
41
+ ```
42
+
43
+ Nothing is written to this package's own install location (site-packages);
44
+ uninstalling with `pip uninstall fahimtalking` never touches that data
45
+ directory - remove it by hand if you want a fully clean slate.
46
+
47
+ ## Security notes
48
+
49
+ * The Hugging Face token is only ever stored encrypted at rest via the
50
+ Windows Data Protection API (DPAPI), scoped to your Windows user account
51
+ on this machine. It is never written to a config file, log, or the
52
+ package itself, and never accepted as a command-line argument (so it
53
+ never lands in shell history).
54
+ * The two runtime archives are downloaded from a *fixed* URL
55
+ (`https://huggingface.co/sallout/fahimtalkingfiles/resolve/main`) baked
56
+ into this package at release time, authenticated with your token via an
57
+ `Authorization: Bearer` header, and verified against a bundled SHA-256
58
+ manifest before anything is extracted.
59
+ * The proprietary application code inside the downloaded runtimes is
60
+ compiled (not shipped as plain `.py`) - see this repository's
61
+ `scripts/protect_source.ps1`. Obfuscation/compilation of *code* is not,
62
+ and is never treated as, protection for the token above; that's what
63
+ DPAPI is for.
64
+
65
+ ## For maintainers: building this package
66
+
67
+ See `../../scripts/build_pypi_wheel.ps1` in this repository and the
68
+ packaging runbook for the full release process (rebuilding the protected
69
+ runtime archives, publishing them to Hugging Face, syncing this package's
70
+ bundled manifest, building the wheel, and testing it in a clean virtual
71
+ environment).
@@ -0,0 +1,38 @@
1
+ [project]
2
+ name = "fahimtalking"
3
+ version = "0.1.0"
4
+ description = "Bootstrap installer/launcher for Fahim Talking. Downloads and verifies the real runtime on first run; ships no proprietary code, models, or heavy dependencies."
5
+ readme = "README.md"
6
+ requires-python = ">=3.12,<3.13"
7
+ license = { text = "Proprietary" }
8
+ authors = [{ name = "Tayseer" }]
9
+ dependencies = []
10
+
11
+ [project.urls]
12
+ Homepage = "https://huggingface.co/sallout/fahimtalkingfiles"
13
+
14
+ [project.scripts]
15
+ fahimtalking = "fahimtalking_bootstrap.cli:main"
16
+
17
+ [project.optional-dependencies]
18
+ dev = [
19
+ "pytest>=8.0",
20
+ "build>=1.2",
21
+ "twine>=5.0",
22
+ ]
23
+
24
+ [build-system]
25
+ requires = ["hatchling"]
26
+ build-backend = "hatchling.build"
27
+
28
+ [tool.hatch.build.targets.wheel]
29
+ packages = ["src/fahimtalking_bootstrap"]
30
+
31
+ [tool.hatch.build.targets.sdist]
32
+ include = [
33
+ "src/fahimtalking_bootstrap",
34
+ "README.md",
35
+ ]
36
+
37
+ [tool.pytest.ini_options]
38
+ testpaths = ["tests"]
@@ -0,0 +1,10 @@
1
+ from __future__ import annotations
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ try:
6
+ __version__ = version("fahimtalking")
7
+ except PackageNotFoundError:
8
+ __version__ = "0.0.0-dev"
9
+
10
+ __all__ = ["__version__"]
@@ -0,0 +1,4 @@
1
+ from fahimtalking_bootstrap.cli import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())
@@ -0,0 +1,157 @@
1
+ # Default configuration for FahimTalking.
2
+ # Override individual keys via config/local.yaml (gitignored) or environment
3
+ # variables prefixed with FAHIM_ (e.g. FAHIM_AUDIO__SAMPLE_RATE=16000).
4
+
5
+ resource_limits:
6
+ cpu_percent_max: 51 # ~10 threads on a 20-thread machine
7
+ cpu_threads_max: 10
8
+ ram_mb_max: 7168 # 7 GB hard ceiling
9
+ ram_mb_static_max: 5120 # 5 GB idle/static budget
10
+ gpu_percent_max: 60
11
+ vram_mb_max: 6656 # 6.5 GB
12
+ disk_mb_max: 51200 # 50 GB
13
+ gpu_device_index: null # set to 0/1/... to pin to one GPU on a multi-GPU machine
14
+
15
+ audio:
16
+ sample_rate: 16000
17
+ channels: 1
18
+ frame_ms: 32 # fixed by Silero VAD: 512 samples @16kHz / 256 @8kHz = 32ms either way
19
+ dtype: int16
20
+ input_device: null # null = system default input device
21
+
22
+ bg_speech:
23
+ # Background speech suppression - runs on every captured frame, before
24
+ # wake-word/VAD/STT ever see it, to suppress background noise and
25
+ # competing talkers. DTLN (breizhn/DTLN, MIT-licensed): chosen over
26
+ # DeepFilterNet3 because it has a real frame-by-frame streaming API
27
+ # (recurrent state carried explicitly between calls) and runs natively at
28
+ # 16kHz - no resampling, no isolated worker process, just onnxruntime -
29
+ # see bg_speech/dtln_model.py's module docstring for the full comparison.
30
+ enabled: true
31
+ model_1_path: "models/bg_speech/model_1.onnx"
32
+ model_2_path: "models/bg_speech/model_2.onnx"
33
+ model_1_url: "https://raw.githubusercontent.com/breizhn/DTLN/master/pretrained_model/model_1.onnx"
34
+ model_2_url: "https://raw.githubusercontent.com/breizhn/DTLN/master/pretrained_model/model_2.onnx"
35
+ auto_download: true # fetch both model_*_path files automatically on first run if missing
36
+
37
+ wakeword:
38
+ enabled: true
39
+ keyword: "hi_moha" # maps to a model file in models/wakeword/
40
+ model_path: "models/wakeword/hi_moha.onnx"
41
+ inference_framework: "onnx"
42
+ detection_threshold: 0.5
43
+ trigger_cooldown_ms: 1500 # ignore repeat triggers within this window
44
+
45
+ vad:
46
+ enabled: true
47
+ # Silero VAD (neural, ~2MB ONNX model) replaced webrtcvad: real desktop-mic
48
+ # testing showed webrtcvad reading room/fan noise as speech even at its
49
+ # most aggressive setting, which stopped silence_timeout_ms from ever
50
+ # triggering (utterances ran to the 30s hard cap instead of ~1s) and fed
51
+ # the STT model long noisy clips, which then hallucinated/repeated text.
52
+ threshold: 0.5 # speech probability above this counts as speech (Silero's own default)
53
+ model_path: "models/vad/silero_vad.onnx"
54
+ download_url: "https://raw.githubusercontent.com/snakers4/silero-vad/master/src/silero_vad/data/silero_vad.onnx"
55
+ auto_download: true # fetch model_path automatically on first run if missing
56
+ # Pure dead time in every response: the pipeline cannot even start
57
+ # transcribing until this much silence has elapsed, so it is a direct
58
+ # floor on time-to-first-audio. Lowered 800 -> 500 as part of latency
59
+ # tuning. The tradeoff is mid-sentence pauses: a user who stops to think
60
+ # for longer than this gets their utterance cut in two and transcribed as
61
+ # a partial question. Raise it back toward 800 if that starts happening.
62
+ silence_timeout_ms: 500 # ms of continuous silence that ends an utterance
63
+ min_utterance_ms: 250 # ignore utterances shorter than this (likely noise)
64
+ max_utterance_ms: 30000 # hard cap to force-finalize very long utterances
65
+ speech_pad_ms: 150 # padding kept before first detected speech frame
66
+
67
+ stt:
68
+ # Phase 1 outcome: Qwen3-ASR-0.6B selected after live Arabic testing (fast,
69
+ # accurate, no native-Windows friction). NVIDIA Parakeet RNNT Multilingual
70
+ # was evaluated (see README) and set aside - not pursued further for now.
71
+ active_engine: "qwen3" # "qwen3" | null (null requires --engine flag)
72
+ candidates:
73
+ qwen3:
74
+ model_id: "Qwen/Qwen3-ASR-0.6B" # confirmed on HuggingFace, Arabic-capable
75
+ device: "cuda"
76
+ precision: "bf16" # official examples use bfloat16, not fp16
77
+
78
+ language:
79
+ # "ar" | "en" | "both" - shared by the STT engine and KB matching (see
80
+ # LanguageConfig in config.py). "ar"/"en" lock both to just that language;
81
+ # "both" restores auto-detection across Arabic and English. Cached answer
82
+ # audio stays bilingual regardless - see admin: below.
83
+ mode: "ar"
84
+
85
+ kb:
86
+ enabled: true
87
+ # Customer-owned content. The file is created when the first FAQ is added
88
+ # in the admin dashboard and is intentionally not included in the SDK.
89
+ data_path: "data/questions.json"
90
+ embedding_model: "intfloat/multilingual-e5-small" # bi-encoder, indexed via FAISS
91
+ reranker_model: "BAAI/bge-reranker-v2-m3" # cross-encoder, multilingual incl. Arabic
92
+ device: "cpu" # "cpu" | "cuda" - both models are small enough for CPU by default
93
+ top_k: 3 # FAISS candidates handed to the reranker
94
+ score_threshold: 0.5 # reranker_score must be >= this to return the matched answer
95
+ not_found_message: "لم أجد إجابة مناسبة"
96
+
97
+ tts:
98
+ # Component 5: text-to-speech, NAMAA-Saudi-TTS (built on Chatterbox
99
+ # Multilingual) run in an isolated worker process - see tts_worker/ and
100
+ # fahim_talking/tts/. Isolated because chatterbox-tts needs
101
+ # transformers==5.2.0 exactly, which conflicts with stt.qwen3's
102
+ # transformers==4.57.6 exact pin; the two can't share one environment.
103
+ enabled: true # voice_pipeline.py only ever plays pre-generated cache audio (see admin: below) -
104
+ # it never loads the TTS worker and has no live-synthesis fallback on a cache miss.
105
+ model_id: "NAMAA-Space/NAMAA-Saudi-TTS"
106
+ ref_audio_path: "models/tts/ref_voice.wav" # cleaned via tts_transfer_v2/prepare_ref_audio.py
107
+ language_id: "ar"
108
+ # Generation params below are pinned to what the user benchmarked as the
109
+ # best-sounding Gulf-Arabic result with this reference voice - do not
110
+ # change without re-testing (see server_namaa.py in tts_transfer_v2/ for
111
+ # what each one does).
112
+ cfg_weight: 0.5
113
+ exaggeration: 0.5
114
+ temperature: 0.7
115
+ repetition_penalty: 1.2
116
+ min_p: 0.05
117
+ top_p: 1.0
118
+ worker_dir: "tts_worker" # separate uv sub-project; see its README/pyproject.toml
119
+ worker_startup_timeout_s: 1800 # first run downloads several GB from HF; cached after that
120
+ chunk_max_chars: 200 # answer text is split into sentence-sized chunks for low first-audio latency
121
+ first_chunk_max_chars: 40 # only the first chunk is capped this small, for fast first-audio on long answers; null disables
122
+ cache_dir: "cache/tts_answers" # pre-generated per-FAQ answer audio (q_{id}_{lang}.wav) - see admin: below
123
+
124
+ admin:
125
+ # Component 6 (optional): standalone content-admin webpage for adding FAQ
126
+ # questions (Arabic + English) and pre-generating their cached answer
127
+ # audio. Runs as its own process - see scripts/run_admin.py. Do not run
128
+ # it at the same time as voice_pipeline.py while generating audio: both
129
+ # spawn the same isolated TTS worker subprocess and would compete for the
130
+ # GPU/VRAM budget.
131
+ enabled: true
132
+ host: "127.0.0.1"
133
+ port: 8080
134
+
135
+ api:
136
+ # Component 7 (optional): client-facing WebSocket voice API - same
137
+ # wake-word -> STT -> KB -> cached-answer-audio pipeline as
138
+ # voice_pipeline.py, but behind a WebSocket instead of the local mic/
139
+ # speakers. Runs as its own process - see scripts/run_api.py. Loads the
140
+ # STT engine + KB once at startup and keeps them warm/shared across every
141
+ # connected client. Never loads the TTS worker - only plays cached answer
142
+ # audio, same rule as voice_pipeline.py (see admin: above).
143
+ enabled: true
144
+ host: "127.0.0.1"
145
+ port: 8090
146
+
147
+ monitoring:
148
+ # Per-cycle usage/latency stats voice_pipeline.py writes and the admin
149
+ # webpage's Usage tab reads - see utils/pipeline_stats.py.
150
+ stats_path: "cache/pipeline_stats.jsonl"
151
+ # Detailed questions, answers, ranks, timings, and failures shown in Logs.
152
+ interaction_log_path: "cache/interaction_logs.jsonl"
153
+ stats_history_limit: 200
154
+
155
+ logging:
156
+ level: "INFO"
157
+ json_output: false
@@ -0,0 +1,24 @@
1
+ {
2
+ "schema_version": 1,
3
+ "product": "Fahim Talking",
4
+ "product_version": "0.1.0",
5
+ "base_url": "https://huggingface.co/sallout/fahimtalkingfiles/resolve/main",
6
+ "runtimes": [
7
+ {
8
+ "name": "main",
9
+ "version": "0.1.0",
10
+ "archive": "fahimtalking-main-runtime-0.1.0-win-x64.zip",
11
+ "destination": "runtime-main",
12
+ "size_bytes": 3049943466,
13
+ "sha256": "CB71780A1E4EAB0B23AC0ACC9E9C0EE031B3BD369F3BE48EE5F2696A08D8C77B"
14
+ },
15
+ {
16
+ "name": "tts",
17
+ "version": "0.1.0",
18
+ "archive": "fahimtalking-tts-runtime-0.1.0-win-x64.zip",
19
+ "destination": "runtime-tts",
20
+ "size_bytes": 3586532197,
21
+ "sha256": "C2033039144E4BD8049B63D3F3A77D2A569C1FF4FD44D1B415512DCEC5DE59A0"
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,9 @@
1
+ BANNER = r"""
2
+ ███████╗ █████╗ ██╗ ██╗██╗███╗ ███╗████████╗ █████╗ ██╗██╗ ██╗██╗███╗ ██╗ ██████╗
3
+ ██╔════╝██╔══██╗██║ ██║██║████╗ ████║╚══██╔══╝██╔══██╗██║██║ ██╔╝██║████╗ ██║██╔════╝
4
+ █████╗ ███████║███████║██║██╔████╔██║ ██║ ███████║██║█████╔╝ ██║██╔██╗ ██║██║ ███╗
5
+ ██╔══╝ ██╔══██║██╔══██║██║██║╚██╔╝██║ ██║ ██╔══██║██║██╔═██╗ ██║██║╚██╗██║██║ ██║
6
+ ██║ ██║ ██║██║ ██║██║██║ ╚═╝ ██║ ██║ ██║ ██║██║██║ ██╗██║██║ ╚████║╚██████╔╝
7
+ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝ ╚═════╝
8
+ By Tayseer Innovations
9
+ """