added model c hange
This commit is contained in:
Binary file not shown.
@@ -6,31 +6,28 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tracker
|
||||
import torch
|
||||
|
||||
def diarize_audio(audio_path, num_speakers=None, hf_token=None):
|
||||
"""
|
||||
Performs speaker diarization using pyannote.audio.
|
||||
|
||||
Args:
|
||||
audio_path (str): Path to audio file.
|
||||
num_speakers (int, optional): Number of speakers if known.
|
||||
hf_token (str): HuggingFace Auth Token.
|
||||
|
||||
Returns:
|
||||
list: List of segments with speaker labels [(start, end, speaker), ...].
|
||||
"""
|
||||
try:
|
||||
from pyannote.audio import Pipeline
|
||||
except ImportError:
|
||||
print("Error: pyannote.audio not installed. Diarization skipped.")
|
||||
tracker.logger.error("Error: pyannote.audio not installed. Diarization skipped.")
|
||||
return None
|
||||
|
||||
if not hf_token:
|
||||
print("Error: HuggingFace Token (HF_TOKEN) not found. Diarization skipped.")
|
||||
tracker.logger.error("Error: HuggingFace Token (HF_TOKEN) not found. Diarization skipped.")
|
||||
return None
|
||||
|
||||
print(f"Loading Diarization Pipeline (pyannote/speaker-diarization-3.1)...")
|
||||
tracker.logger.info(f"Loading Diarization Pipeline (pyannote/speaker-diarization-3.1)...")
|
||||
try:
|
||||
# Fix for PyTorch 2.6+ weights_only issue
|
||||
torch.serialization.add_safe_globals([torch.torch_version.TorchVersion])
|
||||
|
||||
# Note: 'use_auth_token' was deprecated in favor of 'token' in recent versions
|
||||
pipeline = Pipeline.from_pretrained(
|
||||
"pyannote/speaker-diarization-3.1",
|
||||
@@ -38,11 +35,10 @@ def diarize_audio(audio_path, num_speakers=None, hf_token=None):
|
||||
)
|
||||
|
||||
# Move to GPU if available
|
||||
import torch
|
||||
if torch.cuda.is_available():
|
||||
pipeline.to(torch.device("cuda"))
|
||||
|
||||
print(f"Diarizing {audio_path}...")
|
||||
tracker.logger.info(f"Diarizing {audio_path}...")
|
||||
diarization = pipeline(audio_path, num_speakers=num_speakers)
|
||||
|
||||
results = []
|
||||
@@ -56,7 +52,7 @@ def diarize_audio(audio_path, num_speakers=None, hf_token=None):
|
||||
return results
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error during diarization: {e}")
|
||||
tracker.logger.error(f"Error during diarization: {e}")
|
||||
return None
|
||||
|
||||
def merge_diarization_with_transcript(transcript_segments, diarization_segments):
|
||||
|
||||
@@ -60,3 +60,31 @@ Here are the two best ways to do this.
|
||||
```bash
|
||||
tail -f job_output.log
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Method 3: Rescuing a Running Job (The `disown` Method)
|
||||
**Use this if:** You already started the wizard or script in a normal terminal and now realize you need to disconnect without killing it.
|
||||
|
||||
1. **Pause the running job:**
|
||||
Inside the terminal where the script is active, press **`Ctrl` + `Z`**.
|
||||
* The script will pause, and you'll see: `[1]+ Stopped ...`
|
||||
|
||||
2. **Move it to the background:**
|
||||
Type the following command and press Enter:
|
||||
```bash
|
||||
bg
|
||||
```
|
||||
* The script will resume running in the background.
|
||||
|
||||
3. **Disown the job:**
|
||||
Tell the terminal to "forget" about the job so it doesn't kill it when you disconnect:
|
||||
```bash
|
||||
disown -h %1
|
||||
```
|
||||
*(Note: Use `%1` if your job number was `[1]`, `%2` if it was `[2]`, etc.)*
|
||||
|
||||
4. **Disconnect:**
|
||||
You can now type `exit` or close your SSH window. The job will continue on the server.
|
||||
|
||||
**Warning:** Unlike `tmux`, you cannot "reattach" to see the progress bar again. You must monitor the logs in the `logs/` folder to check its status.
|
||||
|
||||
@@ -14,7 +14,7 @@ from utils import LANGUAGE_MAP
|
||||
# Define a retry decorator
|
||||
# ... (retry_policy remains)
|
||||
|
||||
def translate_via_ollama(source_srt_content, target_language="English", model="llama3"):
|
||||
def translate_via_ollama(source_srt_content, target_language="English", model="dolphin-llama3"):
|
||||
"""
|
||||
Translates SRT content using a local Ollama model (Line-by-Line for progress).
|
||||
Includes retries and debug logging.
|
||||
|
||||
@@ -70,7 +70,7 @@ def verify_file_not_empty(file_path):
|
||||
return True
|
||||
return False
|
||||
|
||||
def ensure_ollama_running(model_name="llama3"):
|
||||
def ensure_ollama_running(model_name="dolphin-llama3"):
|
||||
"""
|
||||
Checks if Ollama is running. If not, attempts to start it.
|
||||
Supports Flatpak by escaping to host via flatpak-spawn.
|
||||
|
||||
Reference in New Issue
Block a user