before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
with torch.no_grad():
"""
result = self.engine.synthesize(
sentence,
#speaker_wav=self.params['voice_path'],
speaker=speaker,
voice_dir=pth_... | The `.cpu()` call is redundant here. `torch.from_numpy()` already creates tensors on CPU by default since numpy arrays exist in CPU memory. This unnecessary operation adds overhead without benefit.
```suggestion
``` | with torch.no_grad():
"""
result = self.engine.synthesize(
sentence,
#speaker_wav=self.params['voice_path'],
speaker=speaker,
voice_dir=pth_... | @@ -202,10 +202,12 @@ def convert(self, sentence_index:int, sentence:str)->bool:
audio_tensor = audio_sentence.detach().cpu().unsqueeze(0)
elif isinstance(audio_sentence, np.ndarray):
audio_tensor = torch.from_numpy(audio_sentence).unsqu... | lib/classes/tts_engines/bark.py | 26 | Python | 0.929 | suggestion | 216 | 51 | 51 | false | v25.12.28 | 1,451 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
sentence,
#speaker_wav=self.params['voice_path'],
speaker=speaker,
voice_dir=pth_voice_dir,
**fine_tuned_params
)
"""
... | The `.cpu()` call is redundant here. `torch.tensor()` creates tensors on CPU by default unless a device is explicitly specified. This unnecessary operation adds overhead without benefit.
```suggestion
``` | sentence,
#speaker_wav=self.params['voice_path'],
speaker=speaker,
voice_dir=pth_voice_dir,
**fine_tuned_params
)
"""
... | @@ -202,10 +202,12 @@ def convert(self, sentence_index:int, sentence:str)->bool:
audio_tensor = audio_sentence.detach().cpu().unsqueeze(0)
elif isinstance(audio_sentence, np.ndarray):
audio_tensor = torch.from_numpy(audio_sentence).unsqu... | lib/classes/tts_engines/bark.py | 26 | Python | 0.786 | suggestion | 205 | 51 | 51 | false | v25.12.28 | 1,451 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
#"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight": float,
... | The variable name 'sourceTensor' uses PascalCase, which is inconsistent with Python's snake_case naming convention. Consider renaming it to 'source_tensor' to match the existing naming pattern used by other variables like 'audio_tensor' and 'audio_sentence' in this codebase. | "xtts_temperature": float,
#"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
... | @@ -210,36 +211,27 @@ def _check_xtts_builtin_speakers(self, voice_path:str, speaker:str)->str|bool:
**fine_tuned_params,
)
audio_sentence = result.get('wav')
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/common/utils.py | 26 | Python | 0.5 | suggestion | 275 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | The refactored code adds an additional clone() operation for torch.Tensor inputs. Previously, when audio_sentence was already a torch.Tensor, it would call detach().cpu().unsqueeze(0). Now it calls clone().detach().unsqueeze(0).cpu(). The extra clone() creates an additional copy in memory. If this is intentional for sa... | self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | @@ -179,21 +179,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**speaker_argument
)
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/vits.py | 26 | Python | 1 | refactor | 585 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | The refactored code adds an additional clone() operation for torch.Tensor inputs. Previously, when audio_sentence was already a torch.Tensor, it would call detach().cpu().unsqueeze(0). Now it calls clone().detach().unsqueeze(0).cpu(). The extra clone() creates an additional copy in memory. If this is intentional for sa... | self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | @@ -194,21 +194,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**speaker_argument
)
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/tacotron.py | 26 | Python | 1 | refactor | 585 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight": float,
"xtts_top_k": int,
... | The refactored code adds an additional clone() operation for torch.Tensor inputs. Previously, when audio_sentence was already a torch.Tensor, it would call detach().cpu().unsqueeze(0). Now it calls clone().detach().unsqueeze(0).cpu(). The extra clone() creates an additional copy in memory. If this is intentional for sa... | #"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight": float,
... | @@ -210,36 +211,27 @@ def _check_xtts_builtin_speakers(self, voice_path:str, speaker:str)->str|bool:
**fine_tuned_params,
)
audio_sentence = result.get('wav')
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/common/utils.py | 26 | Python | 1 | refactor | 589 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
#"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight": float,
"xt... | The variable name 'sourceTensor' uses PascalCase, which is inconsistent with Python's snake_case naming convention. Consider renaming it to 'source_tensor' to match the existing naming pattern used by other variables like 'audio_tensor' and 'audio_sentence' in this codebase.
```suggestion
source... | #"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight": float,
"xt... | @@ -141,21 +141,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
)
audio_sentence = result.get('wav')
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/xtts.py | 26 | Python | 1 | suggestion | 456 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | The variable name 'sourceTensor' uses PascalCase, which is inconsistent with Python's snake_case naming convention. Consider renaming it to 'source_tensor' to match the existing naming pattern used by other variables like 'audio_tensor' and 'audio_sentence' in this codebase.
```suggestion
source... | self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | @@ -179,21 +179,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**speaker_argument
)
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/vits.py | 26 | Python | 1 | suggestion | 456 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | The variable name 'sourceTensor' uses PascalCase, which is inconsistent with Python's snake_case naming convention. Consider renaming it to 'source_tensor' to match the existing naming pattern used by other variables like 'audio_tensor' and 'audio_sentence' in this codebase.
```suggestion
source... | self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | @@ -194,21 +194,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**speaker_argument
)
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/tacotron.py | 26 | Python | 1 | suggestion | 456 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
for key, cast_type in {
"bark_text_temp": float,
"bark_waveform_temp": float
}.items()
if self.session.get(key) is not None
}
with torch.no_grad():
... | The variable name 'sourceTensor' uses PascalCase, which is inconsistent with Python's snake_case naming convention. Consider renaming it to 'source_tensor' to match the existing naming pattern used by other variables like 'audio_tensor' and 'audio_sentence' in this codebase.
```suggestion
source... | for key, cast_type in {
"bark_text_temp": float,
"bark_waveform_temp": float
}.items()
if self.session.get(key) is not None
}
with torch.no_grad():
... | @@ -194,25 +194,12 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**tts_dyn_params,
**fine_tuned_params
)
- #audio_sentence = result.get('wav')
- #if is_audio_data_valid(audio_sentence... | lib/classes/tts_engines/bark.py | 26 | Python | 1 | suggestion | 456 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.8 seconds
self.audio_segments.append(pause_tensor.clone())
return True
else:
if sentence.endswith("'"):
sentence... | The refactored code adds an additional clone() operation for torch.Tensor inputs. Previously, when audio_sentence was already a torch.Tensor, it would call detach().cpu().unsqueeze(0). Now it calls clone().detach().unsqueeze(0).cpu(). The extra clone() creates an additional copy in memory. If this is intentional for sa... | pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.8 seconds
self.audio_segments.append(pause_tensor.clone())
return True
else:
if sentence.endswith("'"):
sentence... | @@ -109,21 +109,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**speaker_argument
)
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- audi... | lib/classes/tts_engines/yourtts.py | 26 | Python | 1 | refactor | 585 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
#"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight": float,
"xt... | The refactored code adds an additional clone() operation for torch.Tensor inputs. Previously, when audio_sentence was already a torch.Tensor, it would call detach().cpu().unsqueeze(0). Now it calls clone().detach().unsqueeze(0).cpu(). The extra clone() creates an additional copy in memory. If this is intentional for sa... | #"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight": float,
"xt... | @@ -141,21 +141,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
)
audio_sentence = result.get('wav')
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/xtts.py | 26 | Python | 1 | refactor | 585 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
for key, cast_type in {
"bark_text_temp": float,
"bark_waveform_temp": float
}.items()
if self.session.get(key) is not None
}
with torch.no_grad():
... | The refactored code adds an additional clone() operation for torch.Tensor inputs. Previously, when audio_sentence was already a torch.Tensor, it would call detach().cpu().unsqueeze(0). Now it calls clone().detach().unsqueeze(0).cpu(). The extra clone() creates an additional copy in memory. If this is intentional for sa... | for key, cast_type in {
"bark_text_temp": float,
"bark_waveform_temp": float
}.items()
if self.session.get(key) is not None
}
with torch.no_grad():
... | @@ -194,25 +194,12 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**tts_dyn_params,
**fine_tuned_params
)
- #audio_sentence = result.get('wav')
- #if is_audio_data_valid(audio_sentence... | lib/classes/tts_engines/bark.py | 26 | Python | 1 | refactor | 585 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.8 seconds
self.audio_segments.append(pause_tensor.clone())
return True
else:
if sentence.endswith("'"):
sentence... | The variable name 'sourceTensor' uses PascalCase, which is inconsistent with Python's snake_case naming convention. Consider renaming it to 'source_tensor' to match the existing naming pattern used by other variables like 'audio_tensor' and 'audio_sentence' in this codebase.
```suggestion
source... | pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.8 seconds
self.audio_segments.append(pause_tensor.clone())
return True
else:
if sentence.endswith("'"):
sentence... | @@ -109,21 +109,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**speaker_argument
)
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- audi... | lib/classes/tts_engines/yourtts.py | 26 | Python | 1 | suggestion | 456 | 51 | 51 | false | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | The variable name `sourceTensor` uses camelCase, which is inconsistent with Python naming conventions (PEP 8). Python typically uses snake_case for variable names. Consider renaming to `source_tensor` for consistency with the codebase's Python style.
```suggestion
source_tensor = self._tensor_ty... | self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | @@ -166,21 +166,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**speaker_argument
)
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/fairseq.py | 26 | Python | 1 | suggestion | 431 | 51 | 51 | false | v25.12.29 | 1,457 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
#"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight": float,
... | The variable name `sourceTensor` uses camelCase, which is inconsistent with Python naming conventions (PEP 8). Python typically uses snake_case for variable names. Consider renaming to `source_tensor` for consistency with the codebase's Python style. | "xtts_temperature": float,
#"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
... | @@ -210,36 +211,27 @@ def _check_xtts_builtin_speakers(self, voice_path:str, speaker:str)->str|bool:
**fine_tuned_params,
)
audio_sentence = result.get('wav')
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/common/utils.py | 26 | Python | 0.643 | suggestion | 250 | 51 | 51 | false | v25.12.29 | 1,457 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
for key, cast_type in {
"bark_text_temp": float,
"bark_waveform_temp": float
}.items()
if self.session.get(key) is not None
}
with torch.no_grad():
... | The variable name `sourceTensor` uses camelCase, which is inconsistent with Python naming conventions (PEP 8). Python typically uses snake_case for variable names. Consider renaming to `source_tensor` for consistency with the codebase's Python style.
```suggestion
source_tensor = self._tensor_ty... | for key, cast_type in {
"bark_text_temp": float,
"bark_waveform_temp": float
}.items()
if self.session.get(key) is not None
}
with torch.no_grad():
... | @@ -194,25 +194,12 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**tts_dyn_params,
**fine_tuned_params
)
- #audio_sentence = result.get('wav')
- #if is_audio_data_valid(audio_sentence... | lib/classes/tts_engines/bark.py | 26 | Python | 1 | suggestion | 431 | 51 | 51 | false | v25.12.29 | 1,457 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.8 seconds
self.audio_segments.append(pause_tensor.clone())
return True
else:
if sentence.endswith("'"):
sentence... | The variable name `sourceTensor` uses camelCase, which is inconsistent with Python naming conventions (PEP 8). Python typically uses snake_case for variable names. Consider renaming to `source_tensor` for consistency with the codebase's Python style.
```suggestion
source_tensor = self._tensor_ty... | pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.8 seconds
self.audio_segments.append(pause_tensor.clone())
return True
else:
if sentence.endswith("'"):
sentence... | @@ -109,21 +109,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**speaker_argument
)
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- audi... | lib/classes/tts_engines/yourtts.py | 26 | Python | 1 | suggestion | 431 | 51 | 51 | false | v25.12.29 | 1,457 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
#"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight": float,
"xt... | The variable name `sourceTensor` uses camelCase, which is inconsistent with Python naming conventions (PEP 8). Python typically uses snake_case for variable names. Consider renaming to `source_tensor` for consistency with the codebase's Python style.
```suggestion
source_tensor = self._tensor_ty... | #"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight": float,
"xt... | @@ -141,21 +141,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
)
audio_sentence = result.get('wav')
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/xtts.py | 26 | Python | 1 | suggestion | 431 | 51 | 51 | false | v25.12.29 | 1,457 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | The variable name `sourceTensor` uses camelCase, which is inconsistent with Python naming conventions (PEP 8). Python typically uses snake_case for variable names. Consider renaming to `source_tensor` for consistency with the codebase's Python style.
```suggestion
source_tensor = self._tensor_ty... | self.params['samplerate'] = TTS_VOICE_CONVERSION[self.tts_zs_key]['samplerate']
source_wav = self._resample_wav(tmp_out_wav, self.params['samplerate'])
target_wav = self._resample_wav(self.params['voice_path'], self.params['samplerate']... | @@ -179,21 +179,11 @@ def convert(self, sentence_index:int, sentence:str)->bool:
**speaker_argument
)
if is_audio_data_valid(audio_sentence):
- if isinstance(audio_sentence, torch.Tensor):
- ... | lib/classes/tts_engines/vits.py | 26 | Python | 1 | suggestion | 431 | 51 | 51 | false | v25.12.29 | 1,457 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if len(custom_model_options) > max_custom_model:
error = f'You are allowed to upload a max of {max_custom_models} models'
state['type'] = 'warning'
state['msg'] = error
else:
sessio... | The return statement is missing the voice list update that was previously included. The voice list update should still be returned here since a custom model upload may affect available voices. Consider adding `update_gr_voice_list(id)` back to the return statement or adding a `.then()` chain to the event handler that c... | os.makedirs(dir_path, exist_ok=True)
return dir_path
def change_gr_custom_model_file(f:str|None, t:str, id:str)->tuple:
nonlocal models
if f is not None:
state = {}
if len(custom_model_options) >... | @@ -1296,7 +1303,7 @@ def change_gr_custom_model_file(f:str|None, t:str, id:str)->tuple:
state['type'] = 'success'
state['msg'] = msg
show_alert(state)
- return gr.update(val... | lib/gradio.py | 26 | Python | 0.786 | suggestion | 339 | 51 | 51 | false | v25.12.30 | 1,466 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
fn=change_gr_tts_engine_list,
inputs=[gr_tts_engine_list, gr_session],
outputs=[gr_tts_rating, gr_tab_xtts_params, gr_tab_bark_params, gr_group_custom_model, gr_fine_tuned_list, gr_custom_model_file, gr_voice_list, gr_custom_model_label]
)
gr_fine_... | The outputs list still includes `gr_voice_list`, but the function `change_gr_custom_model_file` now only returns 2 values (line 1306 and 1316). This mismatch will cause a runtime error. Either update the outputs list to remove `gr_voice_list` or ensure the function returns the correct number of values.
```suggestion
... | fn=change_gr_language,
inputs=[gr_language, gr_session],
outputs=[gr_language, gr_tts_engine_list, gr_custom_model_list, gr_fine_tuned_list]
).then(
fn=update_gr_voice_list,
inputs=[gr_session],
outputs=[gr_voice... | @@ -1811,6 +1824,10 @@ def clear_event(id:str)->None:
inputs=[gr_custom_model_file, gr_tts_engine_list, gr_session],
outputs=[gr_custom_model_file, gr_custom_model_list, gr_voice_list], | lib/gradio.py | 26 | Python | 1 | suggestion | 391 | 51 | 51 | false | v25.12.30 | 1,466 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
msg = 'ROCm GPU detected but not compatible or ROCm runtime is missing.'
# ============================================================
# CUDA
# ============================================================
elif has_working_cuda() and has_nvidia_gpu_pc... | The hardcoded library name "libcudart.so" will fail on Windows systems. On Windows, the CUDA runtime library is named "cudart64_XX.dll" (where XX is the version number, e.g., cudart64_12.dll). This code should handle platform-specific library names or use a try-except for each platform variant. Consider using "cudart64... | parts = version_str.split(".")
major = parts[0]
minor = parts[1] if len(parts) > 1 else 0
name = 'rocm'
tag = f'rocm{major}{minor}'
else:
msg = 'ROCm GPU detected but not compatible or... | @@ -447,30 +453,47 @@ def has_working_xpu():
# ============================================================
# CUDA
# ============================================================
- elif has_working_cuda() and has_nvidia_gpu_pci():
+ elif has_working_cuda() and (has_nvidia_gpu_pci... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 1,773 | 51 | 51 | false | v25.12.30 | 1,472 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
# CUDA
# ============================================================
elif has_working_cuda() and has_nvidia_gpu_pci():
version_out = ''
if os.name == 'posix':
for p in... | Bare except catches all exceptions including keyboard interrupts and system exit signals. This can mask critical errors and make debugging difficult. Specify explicit exception types like OSError, FileNotFoundError, or at minimum use "except Exception:" to avoid catching system-level exceptions.
```suggestion
... | major = parts[0]
minor = parts[1] if len(parts) > 1 else 0
name = 'rocm'
tag = f'rocm{major}{minor}'
else:
msg = 'ROCm GPU detected but not compatible or ROCm runtime is missing.'
... | @@ -447,30 +453,47 @@ def has_working_xpu():
# ============================================================
# CUDA
# ============================================================
- elif has_working_cuda() and has_nvidia_gpu_pci():
+ elif has_working_cuda() and (has_nvidia_gpu_pci... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 542 | 51 | 51 | false | v25.12.30 | 1,472 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
msg = 'ROCm GPU detected but not compatible or ROCm runtime is missing.'
# ============================================================
# CUDA
# ============================================================
elif has_working_cuda() and has_nvidia_gpu_pc... | The comment refers to "CUDA RUNTIME detection" but the implementation only queries the runtime version and device count. If cudaGetDeviceCount returns 0 devices (device_count.value == 0), the code silently falls through without setting version_out, which could be misleading. Consider adding a comment or error handling ... | parts = version_str.split(".")
major = parts[0]
minor = parts[1] if len(parts) > 1 else 0
name = 'rocm'
tag = f'rocm{major}{minor}'
else:
msg = 'ROCm GPU detected but not compatible or... | @@ -447,30 +453,47 @@ def has_working_xpu():
# ============================================================
# CUDA
# ============================================================
- elif has_working_cuda() and has_nvidia_gpu_pci():
+ elif has_working_cuda() and (has_nvidia_gpu_pci... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 497 | 51 | 51 | false | v25.12.30 | 1,472 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
break
if not version_out:
msg = 'CUDA hardware detected but NVIDIA CUDA Toolkit not installed.'
else:
version_str = toolkit_version_parse(version_out)
cmp = toolkit_version_compare(version_str, cuda_version_range)
... | The error message has been updated from "CUDA hardware detected" to "CUDA runtime detected", but this message appears when version_out is empty, meaning the toolkit version couldn't be determined. This happens after the runtime detection attempt, so the message is accurate. However, it's worth noting that this scenario... | except Exception:
pass
# CUDA TOOLKIT detection (fallback only)
if not version_out:
if os.name == 'posix':
for p in (
'/usr/local/cuda/version.json',
'/usr/local/cuda/version.txt',
... | @@ -447,30 +453,47 @@ def has_working_xpu():
# ============================================================
# CUDA
# ============================================================
- elif has_working_cuda() and has_nvidia_gpu_pci():
+ elif has_working_cuda() and (has_nvidia_gpu_pci... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 660 | 51 | 51 | false | v25.12.30 | 1,472 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if cmp == -1:
msg = f'ROCm {version_str} < min {rocm_version_range["min"]}. Please upgrade.'
elif cmp == 1:
msg = f'ROCm {version_str} > max {rocm_version_range["max"]}. Falling back to CPU.'
elif cmp == 0:
devic... | The comment says "1) CUDA RUNTIME detection" suggesting there will be a "2)" but there is no corresponding "2)" label for the toolkit detection fallback section. Consider either removing the "1)" or adding "2)" before the "CUDA TOOLKIT detection (fallback only)" comment for consistency. | break
if not version_out:
msg = 'ROCm hardware detected but AMD ROCm base runtime not installed.'
else:
version_str = toolkit_version_parse(version_out)
cmp = toolkit_version_compare(version_str, rocm_version_range)
... | @@ -447,30 +453,47 @@ def has_working_xpu():
# ============================================================
# CUDA
# ============================================================
- elif has_working_cuda() and has_nvidia_gpu_pci():
+ elif has_working_cuda() and (has_nvidia_gpu_pci... | lib/classes/device_installer.py | 26 | Python | 0.5 | suggestion | 287 | 51 | 51 | false | v25.12.30 | 1,473 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
msg = 'ROCm GPU detected but not compatible or ROCm runtime is missing.'
# ============================================================
# CUDA
# ============================================================
elif has_working_cuda() and has_nvidia_gpu_pc... | The runtime detection path requires device_count > 0 before setting version_out, but the fallback toolkit detection path does not perform this check. This creates an inconsistency: if cudaGetDeviceCount returns 0, the code falls back to toolkit detection which may succeed and report a CUDA version even though no device... | parts = version_str.split(".")
major = parts[0]
minor = parts[1] if len(parts) > 1 else 0
name = 'rocm'
tag = f'rocm{major}{minor}'
else:
msg = 'ROCm GPU detected but not compatible or... | @@ -447,30 +453,47 @@ def has_working_xpu():
# ============================================================
# CUDA
# ============================================================
- elif has_working_cuda() and has_nvidia_gpu_pci():
+ elif has_working_cuda() and (has_nvidia_gpu_pci... | lib/classes/device_installer.py | 26 | Python | 0.857 | suggestion | 754 | 51 | 51 | false | v25.12.30 | 1,473 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
msg = f'ROCm {version_str} > max {rocm_version_range["max"]}. Falling back to CPU.'
elif cmp == 0:
devices['ROCM']['found'] = True
parts = version_str.split(".")
major = parts[0]
minor = parts[1] if len(p... | The hardcoded library name "libcudart.so" will only work on Linux/POSIX systems. On Windows, the CUDA runtime library has a different name (typically "cudart64_XX.dll" where XX is the version). This code will fail on Windows systems even though the rest of the code supports Windows through the os.name == 'nt' checks. C... | else:
version_str = toolkit_version_parse(version_out)
cmp = toolkit_version_compare(version_str, rocm_version_range)
if cmp == -1:
msg = f'ROCm {version_str} < min {rocm_version_range["min"]}. Please upgrade.'
elif cmp == 1... | @@ -447,30 +453,47 @@ def has_working_xpu():
# ============================================================
# CUDA
# ============================================================
- elif has_working_cuda() and has_nvidia_gpu_pci():
+ elif has_working_cuda() and (has_nvidia_gpu_pci... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 1,253 | 51 | 51 | false | v25.12.30 | 1,473 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
minor = parts[1] if len(parts) > 1 else 0
name = 'rocm'
tag = f'rocm{major}{minor}'
else:
msg = 'ROCm GPU detected but not compatible or ROCm runtime is missing.'
# ==================================... | The CUDA version calculation formula divides by 1000 for major version and uses modulo 1000 divided by 10 for minor version. This is correct for CUDA runtime version encoding, but this logic should be verified against the ctypes API documentation to ensure it matches the expected CUDA runtime version encoding format. C... | elif cmp == 1:
msg = f'ROCm {version_str} > max {rocm_version_range["max"]}. Falling back to CPU.'
elif cmp == 0:
devices['ROCM']['found'] = True
parts = version_str.split(".")
major = parts[0]
... | @@ -447,30 +453,47 @@ def has_working_xpu():
# ============================================================
# CUDA
# ============================================================
- elif has_working_cuda() and has_nvidia_gpu_pci():
+ elif has_working_cuda() and (has_nvidia_gpu_pci... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 734 | 51 | 51 | false | v25.12.30 | 1,473 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# CUDA
# ============================================================
elif has_working_cuda() and has_nvidia_gpu_pci():
version_out = ''
if os.name == 'posix':
for p in (
'/usr/local/cuda/version.json',
'/usr/local/c... | The comment says "CUDA TOOLKIT detection (fallback only)" but this is actually checking for toolkit version files, not runtime. Consider clarifying the distinction in the comment. The comment should explain that this fallback is used when the runtime detection via ctypes fails, and it looks for CUDA Toolkit installatio... | name = 'rocm'
tag = f'rocm{major}{minor}'
else:
msg = 'ROCm GPU detected but not compatible or ROCm runtime is missing.'
# ============================================================
# CUDA
# ==========... | @@ -447,30 +453,47 @@ def has_working_xpu():
# ============================================================
# CUDA
# ============================================================
- elif has_working_cuda() and has_nvidia_gpu_pci():
+ elif has_working_cuda() and (has_nvidia_gpu_pci... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 698 | 51 | 51 | false | v25.12.30 | 1,473 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
msg = 'CUDA runtime detected but NVIDIA CUDA Toolkit not installed.'
else:
version_str = toolkit_version_parse(version_out)
cmp = toolkit_version_compare(version_str, cuda_version_range)
if cmp == -1:
msg = f'CUDA {version_... | The error message is confusing and contradictory. It states "CUDA runtime detected but NVIDIA CUDA Toolkit or Runtime not installed", which mentions "Runtime" twice in a contradictory way. This message appears when runtime detection failed but `has_working_cuda()` (which checks nvidia-smi) succeeded. Consider clarifyin... | pass
# CUDA TOOLKIT detection (fallback only)
if not version_out:
if os.name == 'posix':
for p in (
'/usr/local/cuda/version.json',
'/usr/local/cuda/version.txt',
):
... | @@ -493,11 +517,11 @@ def has_working_xpu():
version_out = f.read()
break
if not version_out:
- msg = 'CUDA runtime detected but NVIDIA CUDA Toolkit not installed.'
+ if msg == '':
+ msg =... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 727 | 51 | 51 | false | v25.12.30 | 1,474 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
minor = (v % 1000) // 10
version_out = f"{major}.{minor}"
except Exception:
pass
# CUDA TOOLKIT detection (fallback only)
if not version_out:
if os.name == 'posix':
for p in (
... | The error message lacks proper ending punctuation. For consistency with other messages in the file (like lines 435, 440, 442, 526, 528), this message should end with a period.
```suggestion
msg = f'Runtime present ({version.value}) but no devices.'
``` | "cudart64_118.dll",
"cudart64_117.dll",
"cudart64_116.dll",
"cudart64_115.dll",
):
try:
libcudart = ctypes.CDLL(dll)
break
... | @@ -468,7 +490,9 @@ def has_working_xpu():
major = v // 1000
minor = (v % 1000) // 10
version_out = f"{major}.{minor}"
- except Exception:
+ else:
+ msg = f'Runtime present... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 280 | 51 | 51 | false | v25.12.30 | 1,474 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
minor = (v % 1000) // 10
version_out = f"{major}.{minor}"
except Exception:
pass
# CUDA TOOLKIT detection (fallback only)
if not version_out:
if os.name == 'posix':
for p in (
... | The message is missing information about how to format the version value. The version.value is a raw integer (e.g., 12010) and should be formatted like the other parts of the code do (major = v // 1000, minor = (v % 1000) // 10). Currently, users will see a confusing message like "Runtime present (12010) but no devices... | "cudart64_118.dll",
"cudart64_117.dll",
"cudart64_116.dll",
"cudart64_115.dll",
):
try:
libcudart = ctypes.CDLL(dll)
break
... | @@ -468,7 +490,9 @@ def has_working_xpu():
major = v // 1000
minor = (v % 1000) // 10
version_out = f"{major}.{minor}"
- except Exception:
+ else:
+ msg = f'Runtime present... | lib/classes/device_installer.py | 26 | Python | 0.5 | suggestion | 373 | 51 | 51 | false | v25.12.30 | 1,475 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
msg = 'CUDA runtime detected but NVIDIA CUDA Toolkit not installed.'
else:
version_str = toolkit_version_parse(version_out)
cmp = toolkit_version_compare(version_str, cuda_version_range)
if cmp == -1:
msg = f'CUDA {version_... | The error message is unclear and contains a redundant phrase. The message says "NVIDIA CUDA Toolkit or Runtime not installed" but this code path is reached when the runtime detection failed (no runtime was detected), so mentioning "or Runtime" is confusing. Consider simplifying to just "NVIDIA CUDA Toolkit not installe... | pass
# CUDA TOOLKIT detection (fallback only)
if not version_out:
if os.name == 'posix':
for p in (
'/usr/local/cuda/version.json',
'/usr/local/cuda/version.txt',
):
... | @@ -493,11 +517,11 @@ def has_working_xpu():
version_out = f.read()
break
if not version_out:
- msg = 'CUDA runtime detected but NVIDIA CUDA Toolkit not installed.'
+ if msg == '':
+ msg =... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 457 | 51 | 51 | false | v25.12.30 | 1,475 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if not version_out:
msg = 'CUDA runtime detected but NVIDIA CUDA Toolkit not installed.'
else:
version_str = toolkit_version_parse(version_out)
cmp = toolkit_version_compare(version_str, cuda_version_range)
if cmp == -1:
... | The string comparison 'msg == ""' should use an identity check 'not msg' for better Pythonic style and consistency with the rest of the codebase. Empty string checks are better done with truthiness testing.
```suggestion
if not msg:
``` | except (OSError, AttributeError):
pass
# CUDA TOOLKIT detection (fallback only)
if not version_out:
if os.name == 'posix':
for p in (
'/usr/local/cuda/version.json',
'/usr/local/cuda/v... | @@ -493,11 +517,11 @@ def has_working_xpu():
version_out = f.read()
break
if not version_out:
- msg = 'CUDA runtime detected but NVIDIA CUDA Toolkit not installed.'
+ if msg == '': | lib/classes/device_installer.py | 26 | Python | 0.857 | suggestion | 252 | 51 | 51 | false | v25.12.30 | 1,475 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
"cudart64_130.dll",
"cudart64_121.dll",
"cudart64_120.dll",
"cudart64_118.dll",
"cudart64_117.dll",
"cudart64_116.dll",
"cudart64_115.dll",
... | The version parsing is now performed before checking if devices exist. If `device_count.value` is 0, the variables `major` and `minor` are calculated but `version_out` is never set, which may cause issues in downstream code expecting `version_out` to be defined when a runtime is detected. | "cudart64_130.dll",
"cudart64_121.dll",
"cudart64_120.dll",
"cudart64_118.dll",
"cudart64_117.dll",
"cudart64_116.dll",
"cudart64_115.dll",
... | @@ -485,13 +485,13 @@ def has_working_xpu():
if libcudart.cudaRuntimeGetVersion(ctypes.byref(version)) == 0:
device_count = ctypes.c_int()
if libcudart.cudaGetDeviceCount(ctypes.byref(device_count)) == 0:
+ v = version.value
+ ... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 289 | 51 | 51 | false | v25.12.30 | 1,476 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
# ROCm
# ============================================================
elif has_working_rocm() and has_amd_gpu_pci():
version_out = ''
if os.name == 'posix':
for p in (
... | Inconsistent version parsing: On POSIX systems, the raw file content is stored in `version` without using `lib_version_parse()`, but on Windows (line 443), `lib_version_parse(v)` is used. This inconsistency could lead to version comparison issues. Apply `lib_version_parse()` to the result on POSIX systems as well.
```s... | tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):
out = try_cmd('cat /proc/device-tree/compatible')
if 'tegra' in out:
devices['JETSON']['found'] = True
name = 'jetson'... | @@ -377,230 +377,232 @@ def has_working_xpu():
name = None
tag = None
- msg = ''
arch = platform.machine().lower()
+ forced_tag = os.environ.get("DEVICE_TAG")
- # ============================================================
- # JETSON
- # ===============... | lib/classes/device_installer.py | 26 | Python | 0.857 | suggestion | 441 | 51 | 51 | false | v25.12.31 | 1,478 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if os.name == "posix":
# Must have render node
if not os.path.exists("/dev/dri/renderD128"):
return False
# Prefer Level Zero runtime check
if has_cmd("sycl-ls"):
out = try_cmd("sycl-ls").lower()
... | The variable `msg` may not be initialized in certain code paths. Specifically, when entering the else block at line 393 and when no hardware detection conditions match (e.g., for MPS at lines 595-598, or when the CPU fallback at line 603 is reached), `msg` is never set before being referenced at line 607. Initialize `m... | if os.name == "posix":
# Must have render node
if not os.path.exists("/dev/dri/renderD128"):
return False
# Prefer Level Zero runtime check
if has_cmd("sycl-ls"):
out = try_cmd("sycl-ls").lower()
... | @@ -377,230 +377,232 @@ def has_working_xpu():
name = None
tag = None | lib/classes/device_installer.py | 26 | Python | 0.786 | suggestion | 472 | 51 | 51 | false | v25.12.31 | 1,478 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if os.path.exists(p):
with open(p, 'r', encoding='utf-8', errors='ignore') as f:
version_out = f.read()
break
if version_out:
break
if n... | Version range tuples displayed incorrectly in error messages. The error messages at lines 451 and 453 display version ranges as tuples like "(5, 7)" instead of formatted version strings like "5.7". This makes the error messages less user-friendly. Consider formatting these tuples as version strings, e.g., '.'.join(map(... | ):
if os.path.exists(p):
with open(p, 'r', encoding='utf-8', errors='ignore') as f:
version = f.read()
break
elif os.name == 'nt':
for env in ('ROCM_PAT... | @@ -379,228 +379,231 @@ def has_working_xpu():
tag = None
msg = ''
arch = platform.machine().lower()
+ forced_tag = os.environ.get("DEVICE_TAG")
- # ============================================================
- # JETSON
- # ======================================... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 1,011 | 51 | 51 | false | v25.12.31 | 1,480 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
os.path.join(oneapi_root, 'version.txt'),
os.path.join(oneapi_root, 'compiler', 'latest', 'version.txt'),
os.path.join(oneapi_root, 'runtime', 'latest', 'version.txt'),
):
if os.path.exists(p):
... | Version range dictionary displayed incorrectly in error message. The error message displays the entire xpu_version_range dictionary object instead of formatted version strings. This makes the error message unclear to users. Consider formatting the range as a readable string like "min version to max version".
```suggest... | '/opt/intel/oneapi/version.txt',
'/opt/intel/oneapi/compiler/latest/version.txt',
'/opt/intel/oneapi/runtime/latest/version.txt',
):
if os.path.exists(p):
with open(p, 'r', enc... | @@ -379,228 +379,231 @@ def has_working_xpu():
tag = None
msg = ''
arch = platform.machine().lower()
+ forced_tag = os.environ.get("DEVICE_TAG")
- # ============================================================
- # JETSON
- # ======================================... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 840 | 51 | 51 | false | v25.12.31 | 1,480 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
# ROCm
# ============================================================
elif has_working_rocm() and has_amd_gpu_pci():
version_out = ''
if os.name == 'posix':
for p in (
... | Inconsistent version parsing for ROCm on POSIX vs Windows. On Windows (line 444), `lib_version_parse()` is called on the read version string, but on POSIX (line 431), the raw version string is used directly without parsing. This inconsistency could lead to version comparison failures on POSIX systems if the version fil... | tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):
out = try_cmd('cat /proc/device-tree/compatible')
if 'tegra' in out:
devices['JETSON']['found'] = True
name = 'jetson'... | @@ -379,228 +379,231 @@ def has_working_xpu():
tag = None
msg = ''
arch = platform.machine().lower()
+ forced_tag = os.environ.get("DEVICE_TAG")
- # ============================================================
- # JETSON
- # ======================================... | lib/classes/device_installer.py | 26 | Python | 0.857 | bug | 513 | 51 | 51 | false | v25.12.31 | 1,480 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
os.path.join(cuda_path, 'version.json'),
os.path.join(cuda_path, 'version.txt'),
):
if os.path.exists(p):
with open(p, 'r', encoding='utf-8', errors='ignore') as f:
... | Version range tuples displayed incorrectly in error messages. The error messages at lines 535 and 537 display version ranges as tuples like "(11, 8)" instead of formatted version strings like "11.8". This makes the error messages less user-friendly. Consider formatting these tuples as version strings, e.g., '.'.join(ma... | '/usr/local/cuda/version.json',
'/usr/local/cuda/version.txt',
):
if os.path.exists(p):
with open(p, 'r', encoding='utf-8', errors='ignore') as f:
... | @@ -379,228 +379,231 @@ def has_working_xpu():
tag = None
msg = ''
arch = platform.machine().lower()
+ forced_tag = os.environ.get("DEVICE_TAG")
- # ============================================================
- # JETSON
- # ======================================... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 785 | 51 | 51 | false | v25.12.31 | 1,480 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
libcudart = None
if os.name == "nt":
# Native Windows: CUDA runtime is a DLL
for dll in (
"cudart64_130.dll",
"cudart64_121.dll",
"cudart64_120.dll",
"c... | 'except' clause does nothing but pass and there is no explanatory comment.
```suggestion
except OSError:
# Expected if this specific CUDA runtime DLL is not present; try next candidate.
``` | msg = 'ROCm GPU detected but not compatible or ROCm runtime is missing.'
else:
msg = 'ROCm hardware detected but AMD ROCm base runtime not installed.'
# ============================================================
# CUDA
# ... | @@ -379,228 +379,231 @@ def has_working_xpu():
tag = None
msg = ''
arch = platform.machine().lower()
+ forced_tag = os.environ.get("DEVICE_TAG")
- # ============================================================
- # JETSON
- # ======================================... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 257 | 51 | 51 | false | v25.12.31 | 1,480 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
libcudart = ctypes.CDLL("libcudart.so")
if not libcudart:
raise OSError
version = ctypes.c_int()
if libcudart.cudaRuntimeGetVersion(ctypes.byref(version)) == 0:
device_count = ctypes.c_int()
i... | 'except' clause does nothing but pass and there is no explanatory comment.
```suggestion
except (OSError, AttributeError):
# CUDA runtime library not available or unusable; fall back to toolkit-based detection below.
``` | end_minor = max_minor if major == max_major else 9
for minor in range(start_minor, end_minor + 1):
dll = f"cudart64_{major}{minor}.dll"
try:
libcudart = ctypes.CDLL... | @@ -379,228 +379,231 @@ def has_working_xpu():
tag = None
msg = ''
arch = platform.machine().lower()
+ forced_tag = os.environ.get("DEVICE_TAG")
- # ============================================================
- # JETSON
- # ======================================... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 256 | 51 | 51 | false | v25.12.31 | 1,480 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
def segment_ideogramms(text:str)->list[str]:
sml_pattern = '|'.join(re.escape(token) for token in sml_tokens)
segments = re.split(f'({sml_pattern})', text)
result = []
try:
for segment in segments:
if not segment:
continue
... | Commented-out code should be removed rather than left in the codebase. If the old sudachipy implementation needs to be preserved for reference, consider documenting it in version control history or project documentation instead.
```suggestion
``` |
def segment_ideogramms(text:str)->list[str]:
sml_pattern = '|'.join(re.escape(token) for token in sml_tokens)
segments = re.split(f'({sml_pattern})', text)
result = []
try:
for segment in segments:
if not segment:
continue
... | @@ -1039,10 +1039,15 @@ def segment_ideogramms(text:str)->list[str]:
jieba.dt.cache_file = os.path.join(models_dir, 'jieba.cache')
result.extend([t for t in jieba.cut(segment) if t.strip()])
elif lang == 'jpn':
+ """
... | lib/core.py | 26 | Python | 0.857 | suggestion | 247 | 51 | 51 | false | v25.12.32 | 1,485 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
else:
cmd += ['-f', 'ffmetadata', '-i', ffmpeg_metadata_file, '-map', '0:a']
if session['output_format'] in ['m4a', 'm4b', 'mp4', 'mov']:
target_codec = 'aac'
target_rate = '44100'
cmd += ['-c:a', 'aac', '-b:a', '192... | The simplified logic assumes 'output_channel' will always exist in session. While this appears to be guaranteed by line 2325, consider adding a default value using session.get('output_channel', 'mono') for defensive programming.
```suggestion
if session.get('output_channel', 'mono') == 'stereo':
``` | target_rate = '44100'
cmd += ['-c:a', 'aac', '-b:a', '192k', '-ar', target_rate, '-movflags', '+faststart']
elif session['output_format'] == 'flac':
target_codec = 'flac'
target_rate = '44100'
cmd += ['-c:a', 'flac', '-compressi... | @@ -1941,11 +1947,10 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin
target_rate = '48000'
cmd += ['-c:a', 'libopus', '-compression_level', '0', '-b:a', '192k', '-ar', target_rate]
cmd += ['-map_metadata', '1']
- ... | lib/core.py | 26 | Python | 0.857 | suggestion | 312 | 51 | 51 | false | v25.12.32 | 1,485 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
else:
cmd += ['-f', 'ffmetadata', '-i', ffmpeg_metadata_file, '-map', '0:a']
if session['output_format'] in ['m4a', 'm4b', 'mp4', 'mov']:
target_codec = 'aac'
target_rate = '44100'
cmd += ['-c:a', 'aac', '-b:a', '192... | This code assumes 'output_channel' exists in the session dictionary, but will raise a KeyError if the key is missing. While the session parameter is now set at line 2325, this function could be called in contexts where the session was created before that change. Use session.get('output_channel', 'mono') to provide a sa... | target_rate = '44100'
cmd += ['-c:a', 'aac', '-b:a', '192k', '-ar', target_rate, '-movflags', '+faststart']
elif session['output_format'] == 'flac':
target_codec = 'flac'
target_rate = '44100'
cmd += ['-c:a', 'flac', '-compressi... | @@ -1941,11 +1947,10 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin
target_rate = '48000'
cmd += ['-c:a', 'libopus', '-compression_level', '0', '-b:a', '192k', '-ar', target_rate]
cmd += ['-map_metadata', '1']
- ... | lib/core.py | 26 | Python | 1 | suggestion | 459 | 51 | 51 | false | v25.12.32 | 1,486 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
elif os.path.exists('/proc/device-tree/compatible'):
out = try_cmd('cat /proc/device-tree/compatible')
if 'tegra' in out:
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_co... | The variable name 'v' is too short and ambiguous. It should be renamed to something more descriptive like 'version_string' or 'raw_version' to clarify that it contains the unparsed version text. | elif os.path.exists('/proc/device-tree/compatible'):
out = try_cmd('cat /proc/device-tree/compatible')
if 'tegra' in out:
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_co... | @@ -428,7 +428,8 @@ def has_working_xpu():
):
if os.path.exists(p):
with open(p, 'r', encoding='utf-8', errors='ignore') as f:
- version = f.read()
+ v = f.read()
+ ... | lib/classes/device_installer.py | 26 | Python | 0.429 | suggestion | 194 | 51 | 51 | false | v25.12.32 | 1,486 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return text
def convert_chapters2audio(id:str)->bool:
session = context.get_session(id)
if session:
try:
if session['cancellation_requested']:
msg = 'Cancel requested'
print(msg)
return False
tts_manager = TTSManager(session)
... | This debug print statement should be removed or replaced with proper logging using the logging module for production code. | print(msg)
return False
tts_manager = TTSManager(session)
resume_chapter = 0
missing_chapters = []
resume_sentence = 0
missing_sentences = []
existing_chapters = sorted(
[f for f in os.listdir(session... | @@ -1658,6 +1650,7 @@ def convert_chapters2audio(id:str)->bool:
[f for f in os.listdir(session['chapters_dir_sentences']) if f.endswith(f'.{default_audio_proc_format}')],
key=lambda x: int(re.search(r'\d+', x).group())
)
+ print(f'----------{existing_sentences}-... | lib/core.py | 26 | Python | 0.571 | bug | 122 | 51 | 51 | false | v25.12.32 | 1,487 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
def find_id_by_hash(self, socket_hash:str)->str|None:
for id, session in self.sessions.items():
if socket_hash in session:
return session['id']
return None
class JSONDictProxyEncoder(json.JSONEncoder):
def default(self, o:Any)->Any:
if isinstance(o, DictProx... | With the removal of the resume logic, the chapters directory is no longer cleaned before processing. This means that if a previous run left files in the chapters_dir, they will not be removed, potentially causing issues with processing or mixing old and new chapter files.
```suggestion
os.makedirs(session['... |
def find_id_by_hash(self, socket_hash:str)->str|None:
for id, session in self.sessions.items():
if socket_hash in session:
return session['id']
return None
class JSONDictProxyEncoder(json.JSONEncoder):
def default(self, o:Any)->Any:
if isinstance(o, DictProx... | @@ -230,14 +230,9 @@ def prepare_dirs(src:str, id:str)->bool:
os.makedirs(session['custom_model_dir'], exist_ok=True)
os.makedirs(session['voice_dir'], exist_ok=True)
os.makedirs(session['audiobooks_dir'], exist_ok=True) | lib/core.py | 26 | Python | 0.857 | suggestion | 827 | 51 | 51 | false | v25.12.32 | 1,487 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return text
def convert_chapters2audio(id:str)->bool:
session = context.get_session(id)
if session:
try:
if session['cancellation_requested']:
msg = 'Cancel requested'
print(msg)
return False
tts_manager = TTSManager(session)
... | This debug print statement should be removed before merging to production. It appears to be leftover debugging code that prints the existing_sentences list with dashes around it.
```suggestion
``` | print(msg)
return False
tts_manager = TTSManager(session)
resume_chapter = 0
missing_chapters = []
resume_sentence = 0
missing_sentences = []
existing_chapters = sorted(
[f for f in os.listdir(session... | @@ -1653,6 +1650,7 @@ def convert_chapters2audio(id:str)->bool:
[f for f in os.listdir(session['chapters_dir_sentences']) if f.endswith(f'.{default_audio_proc_format}')],
key=lambda x: int(re.search(r'\d+', x).group())
)
+ print(f'----------{existing_sentences}-... | lib/core.py | 26 | Python | 0.929 | bug | 197 | 51 | 51 | false | v25.12.32 | 1,488 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return session['id']
return None
class JSONDictProxyEncoder(json.JSONEncoder):
def default(self, o:Any)->Any:
if isinstance(o, DictProxy):
return dict(o)
elif isinstance(o, ListProxy):
return list(o)
return super().default(o)
def prepare_dirs... | The removal of the resume logic and chapters_dir cleanup could lead to stale data issues. Previously, if a different ebook was processed with the same ID (detected via hash comparison), the chapters_dir would be cleaned up. Now, old chapter files may remain and cause conflicts when processing a different source file. C... | return session['id']
return None
class JSONDictProxyEncoder(json.JSONEncoder):
def default(self, o:Any)->Any:
if isinstance(o, DictProxy):
return dict(o)
elif isinstance(o, ListProxy):
return list(o)
return super().default(o)
def prepare_dirs... | @@ -230,14 +230,9 @@ def prepare_dirs(src:str, id:str)->bool:
os.makedirs(session['custom_model_dir'], exist_ok=True)
os.makedirs(session['voice_dir'], exist_ok=True)
os.makedirs(session['audiobooks_dir'], exist_ok=True)
- session['ebook'] = os.path.join(session['proces... | lib/core.py | 26 | Python | 0.5 | suggestion | 374 | 51 | 51 | false | v25.12.32 | 1,488 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The logic for handling voice changes has been inverted incorrectly. When the voice file exists and `set_voice()` succeeds, the code returns `True` (line 102), but for all other SML tokens (break, pause), the function doesn't return anything explicitly in their branches, falling through to `return False` at line 106. Th... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -96,14 +96,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voice'... | lib/classes/tts_engines/xtts.py | 26 | Python | 0.643 | bug | 564 | 51 | 51 | false | v25.12.33 | 1,498 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The logic for handling voice changes has been inverted incorrectly. When the voice file exists and `set_voice()` succeeds, the code returns `True` (line 103), but for all other SML tokens (break, pause), the function doesn't return anything explicitly in their branches, falling through to `return False` at line 107. Th... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -97,14 +97,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voice'... | lib/classes/tts_engines/vits.py | 26 | Python | 0.643 | bug | 564 | 51 | 51 | false | v25.12.33 | 1,498 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The logic for handling voice changes has been inverted incorrectly. When the voice file exists and `set_voice()` succeeds, the code returns `True` (line 120), but for all other SML tokens (break, pause), the function doesn't return anything explicitly in their branches, falling through to `return False` at line 124. Th... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -114,14 +114,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voic... | lib/classes/tts_engines/tacotron.py | 26 | Python | 0.643 | bug | 564 | 51 | 51 | false | v25.12.33 | 1,498 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The logic for handling voice changes has been inverted incorrectly. When the voice file exists and `set_voice()` succeeds, the code returns `True` (line 95), but for all other SML tokens (break, pause), the function doesn't return anything explicitly in their branches, falling through to `return False` at line 99. This... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -89,14 +89,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voice'... | lib/classes/tts_engines/fairseq.py | 26 | Python | 0.643 | bug | 562 | 51 | 51 | false | v25.12.33 | 1,498 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The logic for handling voice changes has been inverted incorrectly. When the voice file exists and `set_voice()` succeeds, the code returns `True` (line 141), but for all other SML tokens (break, pause), the function doesn't return anything explicitly in their branches, falling through to `return False` at line 145. Th... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -135,14 +135,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voic... | lib/classes/tts_engines/bark.py | 26 | Python | 0.643 | bug | 564 | 51 | 51 | false | v25.12.33 | 1,498 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if total_chapters == 0:
error = 'No chapterrs found!'
print(error)
return False
total_iterations = sum(len(session['chapters'][x]) for x in range(total_chapters))
total_sentences = sum(sum(1 for row in chapter) for chapter in session['c... | Changing chapter_idx from `c + 1` to `c` introduces a logic bug. The existing code used 1-based indexing for chapter IDs (matching the file naming pattern `chapter_1.{format}`, `chapter_2.{format}`, etc.), but this change switches to 0-based indexing. This will cause a mismatch with the chapter file naming at line 1687... | total_chapters = len(session['chapters'])
if total_chapters == 0:
error = 'No chapterrs found!'
print(error)
return False
total_iterations = sum(len(session['chapters'][x]) for x in range(total_chapters))
total_sentences = s... | @@ -1675,17 +1676,17 @@ def convert_chapters2audio(id:str)->bool:
if session['ebook']:
ebook_name = Path(session['ebook']).name
with tqdm(total=total_iterations, desc='0.00%', bar_format='{desc}: {n_fmt}/{total_fmt} ', unit='step', initial=0) as t:
- sen... | lib/core.py | 26 | Python | 1 | bug | 743 | 51 | 51 | false | v25.12.33 | 1,498 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if session['is_gui_process']:
progress_bar = gr.Progress(track_tqdm=False)
if session['ebook']:
ebook_name = Path(session['ebook']).name
with tqdm(total=total_iterations, desc='0.00%', bar_format='{desc}: {n_fmt}/{total_fmt} ', unit='step', initial... | The variable `sentence_idx` is being reused in a nested loop, which will overwrite the outer loop's sentence counter. The outer loop initializes `sentence_idx = 0` at line 1679 to track the global sentence index across all chapters, but this inner loop's `enumerate(sentences)` will reset it to the local sentence index ... | print(msg)
if session['is_gui_process']:
progress_bar = gr.Progress(track_tqdm=False)
if session['ebook']:
ebook_name = Path(session['ebook']).name
with tqdm(total=total_iterations, desc='0.00%', bar_format='{desc}: {n_fmt}/{total_fmt} ... | @@ -1694,20 +1695,20 @@ def convert_chapters2audio(id:str)->bool:
print(msg)
msg = f'Block {chapter_idx} containing {len(sentences)} sentences…'
print(msg)
- for sentence_num, sentence in enumerate(sentences):
+ ... | lib/core.py | 26 | Python | 0.643 | style | 512 | 51 | 51 | false | v25.12.33 | 1,498 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The logic for handling voice changes has been inverted incorrectly. When the voice file exists and `set_voice()` succeeds, the code returns `True` (line 92), but for all other SML tokens (break, pause), the function doesn't return anything explicitly in their branches, falling through to `return False` at line 96. This... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -86,14 +86,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voice'... | lib/classes/tts_engines/yourtts.py | 26 | Python | 0.643 | bug | 562 | 51 | 51 | false | v25.12.33 | 1,498 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The return logic in convert_sml is incorrect. When the voice file exists and set_voice succeeds, it returns True. However, when handling 'break' or 'pause' tokens (which are successfully processed), or when the voice file doesn't exist (an error condition), it falls through to return False at the end. This means succes... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -114,14 +114,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voic... | lib/classes/tts_engines/tacotron.py | 26 | Python | 0.643 | bug | 553 | 51 | 51 | false | V25 -> V26 | 1,499 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The return logic in convert_sml is incorrect. When the voice file exists and set_voice succeeds, it returns True. However, when handling 'break' or 'pause' tokens (which are successfully processed), or when the voice file doesn't exist (an error condition), it falls through to return False at the end. This means succes... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -89,14 +89,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voice'... | lib/classes/tts_engines/fairseq.py | 26 | Python | 0.643 | bug | 553 | 51 | 51 | false | V25 -> V26 | 1,499 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The return logic in convert_sml is incorrect. When the voice file exists and set_voice succeeds, it returns True. However, when handling 'break' or 'pause' tokens (which are successfully processed), or when the voice file doesn't exist (an error condition), it falls through to return False at the end. This means succes... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -135,14 +135,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voic... | lib/classes/tts_engines/bark.py | 26 | Python | 0.643 | bug | 553 | 51 | 51 | false | V25 -> V26 | 1,499 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if session['is_gui_process']:
progress_bar = gr.Progress(track_tqdm=False)
if session['ebook']:
ebook_name = Path(session['ebook']).name
with tqdm(total=total_iterations, desc='0.00%', bar_format='{desc}: {n_fmt}/{total_fmt} ', unit='step', initial... | The variable 'sentence_idx' is being reused as the loop iteration variable in enumerate, which overwrites the cumulative sentence index initialized at line 1679. This means the global sentence tracking across all chapters is lost, and sentence indices will restart from 0 for each chapter. This causes incorrect sentence... | print(msg)
if session['is_gui_process']:
progress_bar = gr.Progress(track_tqdm=False)
if session['ebook']:
ebook_name = Path(session['ebook']).name
with tqdm(total=total_iterations, desc='0.00%', bar_format='{desc}: {n_fmt}/{total_fmt} ... | @@ -1694,20 +1695,20 @@ def convert_chapters2audio(id:str)->bool:
print(msg)
msg = f'Block {chapter_idx} containing {len(sentences)} sentences…'
print(msg)
- for sentence_num, sentence in enumerate(sentences):
+ ... | lib/core.py | 26 | Python | 0.5 | bug | 499 | 51 | 51 | false | V25 -> V26 | 1,499 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
sentence_num = 0
sml_values = {
v['token']
for v in TTS_SML.values()
if isinstance(v, dict) and 'token' in v
}
for c in range(0, total_chapters):
... | Using the chapter-local enumerate index 'sentence_idx' to check against the global 'missing_sentences' set is incorrect. The missing_sentences contains globally numbered sentence indices, but enumerate provides 0-based indices relative to the current chapter. This will cause incorrect identification of which sentences ... | with tqdm(total=total_iterations, desc='0.00%', bar_format='{desc}: {n_fmt}/{total_fmt} ', unit='step', initial=0) as t:
sentence_idx = 0
sml_values = {
v['token']
for v in TTS_SML.values()
if... | @@ -1694,20 +1695,20 @@ def convert_chapters2audio(id:str)->bool:
print(msg)
msg = f'Block {chapter_idx} containing {len(sentences)} sentences…'
print(msg)
- for sentence_num, sentence in enumerate(sentences):
+ ... | lib/core.py | 26 | Python | 0.5 | bug | 334 | 51 | 51 | false | V25 -> V26 | 1,499 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
chapter_audio_file = f'chapter_{chapter_idx}.{default_audio_proc_format}'
sentences = session['chapters'][c]
start = sentence_num
if c in missing_chapters:
msg = f'********* Recovering missing blo... | Using the chapter-local enumerate index 'sentence_idx' when calling convert_sentence2audio is incorrect. The function expects a globally unique sentence index across all chapters for proper file naming, but enumerate provides 0-based indices that restart for each chapter. This will cause sentence audio files to be over... | chapter_idx = c
chapter_audio_file = f'chapter_{chapter_idx}.{default_audio_proc_format}'
sentences = session['chapters'][c]
start = sentence_idx
if c in missing_chapters:
... | @@ -1694,20 +1695,20 @@ def convert_chapters2audio(id:str)->bool:
print(msg)
msg = f'Block {chapter_idx} containing {len(sentences)} sentences…'
print(msg)
- for sentence_num, sentence in enumerate(sentences):
+ ... | lib/core.py | 26 | Python | 0.5 | bug | 354 | 51 | 51 | false | V25 -> V26 | 1,499 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
print(msg)
return False
if sentence_num in missing_sentences or sentence_num >= resume_sentence:
sentence = sentence.strip()
if len(sentence) > 2 and any(c.isalnum(... | Using 'sentence_idx' (the chapter-local enumerate index) to compare against 'resume_sentence' (a global sentence index) is incorrect. This comparison determines whether to combine audio for the chapter, but it's comparing indices from different scopes. The comparison should use a globally tracked sentence index. | msg = 'Cancel requested'
print(msg)
return False
if sentence_idx in missing_sentences or sentence_idx >= resume_sentence:
sentence = sentence.strip()
... | @@ -1718,10 +1719,10 @@ def convert_chapters2audio(id:str)->bool:
msg = f' : {sentence}'
print(msg)
t.update(1)
- end = sentence_num
+ end = sentence_idx
msg ... | lib/core.py | 26 | Python | 0.5 | bug | 313 | 51 | 51 | false | V25 -> V26 | 1,499 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The return logic in convert_sml is incorrect. When the voice file exists and set_voice succeeds, it returns True. However, when handling 'break' or 'pause' tokens (which are successfully processed), or when the voice file doesn't exist (an error condition), it falls through to return False at the end. This means succes... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -86,14 +86,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voice'... | lib/classes/tts_engines/yourtts.py | 26 | Python | 0.643 | bug | 553 | 51 | 51 | false | V25 -> V26 | 1,499 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The return logic in convert_sml is incorrect. When the voice file exists and set_voice succeeds, it returns True. However, when handling 'break' or 'pause' tokens (which are successfully processed), or when the voice file doesn't exist (an error condition), it falls through to return False at the end. This means succes... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -96,14 +96,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voice'... | lib/classes/tts_engines/xtts.py | 26 | Python | 0.643 | bug | 553 | 51 | 51 | false | V25 -> V26 | 1,499 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
return True
def convert_sml(self, sml:str)->None:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | The return logic in convert_sml is incorrect. When the voice file exists and set_voice succeeds, it returns True. However, when handling 'break' or 'pause' tokens (which are successfully processed), or when the voice file doesn't exist (an error condition), it falls through to return False at the end. This means succes... | return False
return True
def convert_sml(self, sml:str)->bool:
if sml == TTS_SML['break']['token']:
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
break_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 0.4 to 0.7 secon... | @@ -97,14 +97,14 @@ def convert_sml(self, sml:str)->None:
pause_tensor = torch.zeros(1, int(self.params['samplerate'] * silence_time)) # 1.0 to 1.6 seconds
self.audio_segments.append(pause_tensor.clone())
elif TTS_SML['voice']['match'].fullmatch(sml):
- self.session['voice'... | lib/classes/tts_engines/vits.py | 26 | Python | 0.643 | bug | 553 | 51 | 51 | false | V25 -> V26 | 1,499 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and part[-1] != '—':
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
... | The text processing logic `re.sub(r'\s+', ' ', default_sml_pattern.sub('', sentence)).strip()` is duplicated across all six TTS engine files (yourtts.py, xtts.py, vits.py, tacotron.py, fairseq.py, and bark.py). This duplication makes the code harder to maintain - if this logic needs to be updated or fixed, it would nee... | self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and part[-1] != '—':
silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
... | @@ -165,7 +165,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
sentence_obj = {
"start": start_time,
"end": end_time,
- "text": sentence,
+ "text": re.sub(r'\s+', ' ', default_sml_pattern... | lib/classes/tts_engines/yourtts.py | 26 | Python | 0.643 | refactor | 594 | 47 | 47 | false | v25.12.33 | 1,501 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
part_tensor = trim_audio(part_tensor.squeeze(), self.params['samplerate'], 0.001, trim_audio_buffer).unsqueeze(0)
self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and p... | The text processing logic `re.sub(r'\s+', ' ', default_sml_pattern.sub('', sentence)).strip()` is duplicated across all six TTS engine files (yourtts.py, xtts.py, vits.py, tacotron.py, fairseq.py, and bark.py). This duplication makes the code harder to maintain - if this logic needs to be updated or fixed, it would nee... | part_tensor = trim_audio(part_tensor.squeeze(), self.params['samplerate'], 0.001, trim_audio_buffer).unsqueeze(0)
self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and p... | @@ -197,7 +197,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
sentence_obj = {
"start": start_time,
"end": end_time,
- "text": sentence,
+ "text": re.sub(r'\s+', ' ', default_sml_pattern... | lib/classes/tts_engines/xtts.py | 26 | Python | 0.643 | refactor | 594 | 47 | 47 | false | v25.12.33 | 1,501 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
part_tensor = trim_audio(part_tensor.squeeze(), self.params['samplerate'], 0.001, trim_audio_buffer).unsqueeze(0)
self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and p... | The text processing logic `re.sub(r'\s+', ' ', default_sml_pattern.sub('', sentence)).strip()` is duplicated across all six TTS engine files (yourtts.py, xtts.py, vits.py, tacotron.py, fairseq.py, and bark.py). This duplication makes the code harder to maintain - if this logic needs to be updated or fixed, it would nee... | part_tensor = trim_audio(part_tensor.squeeze(), self.params['samplerate'], 0.001, trim_audio_buffer).unsqueeze(0)
self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and p... | @@ -240,7 +240,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
sentence_obj = {
"start": start_time,
"end": end_time,
- "text": sentence,
+ "text": re.sub(r'\s+', ' ', default_sml_pattern... | lib/classes/tts_engines/vits.py | 26 | Python | 0.643 | refactor | 594 | 47 | 47 | false | v25.12.33 | 1,501 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
part_tensor = trim_audio(part_tensor.squeeze(), self.params['samplerate'], 0.001, trim_audio_buffer).unsqueeze(0)
self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and p... | The text processing logic `re.sub(r'\s+', ' ', default_sml_pattern.sub('', sentence)).strip()` is duplicated across all six TTS engine files (yourtts.py, xtts.py, vits.py, tacotron.py, fairseq.py, and bark.py). This duplication makes the code harder to maintain - if this logic needs to be updated or fixed, it would nee... | part_tensor = trim_audio(part_tensor.squeeze(), self.params['samplerate'], 0.001, trim_audio_buffer).unsqueeze(0)
self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and p... | @@ -255,7 +255,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
sentence_obj = {
"start": start_time,
"end": end_time,
- "text": sentence,
+ "text": re.sub(r'\s+', ' ', default_sml_pattern... | lib/classes/tts_engines/tacotron.py | 26 | Python | 0.857 | refactor | 654 | 47 | 47 | false | v25.12.33 | 1,501 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
part_tensor = trim_audio(part_tensor.squeeze(), self.params['samplerate'], 0.001, trim_audio_buffer).unsqueeze(0)
self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and p... | The text processing logic `re.sub(r'\s+', ' ', default_sml_pattern.sub('', sentence)).strip()` is duplicated across all six TTS engine files (yourtts.py, xtts.py, vits.py, tacotron.py, fairseq.py, and bark.py). This duplication makes the code harder to maintain - if this logic needs to be updated or fixed, it would nee... | part_tensor = trim_audio(part_tensor.squeeze(), self.params['samplerate'], 0.001, trim_audio_buffer).unsqueeze(0)
self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and p... | @@ -227,7 +227,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
sentence_obj = {
"start": start_time,
"end": end_time,
- "text": sentence,
+ "text": re.sub(r'\s+', ' ', default_sml_pattern... | lib/classes/tts_engines/fairseq.py | 26 | Python | 0.857 | refactor | 654 | 47 | 47 | false | v25.12.33 | 1,501 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
part_tensor = trim_audio(part_tensor.squeeze(), self.params['samplerate'], 0.001, trim_audio_buffer).unsqueeze(0)
self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and p... | The text processing logic `re.sub(r'\s+', ' ', default_sml_pattern.sub('', sentence)).strip()` is duplicated across all six TTS engine files (yourtts.py, xtts.py, vits.py, tacotron.py, fairseq.py, and bark.py). This duplication makes the code harder to maintain - if this logic needs to be updated or fixed, it would nee... | part_tensor = trim_audio(part_tensor.squeeze(), self.params['samplerate'], 0.001, trim_audio_buffer).unsqueeze(0)
self.audio_segments.append(part_tensor)
if not re.search(r'\w$', part, flags=re.UNICODE) and p... | @@ -251,7 +251,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
sentence_obj = {
"start": start_time,
"end": end_time,
- "text": sentence,
+ "text": re.sub(r'\s+', ' ', default_sml_pattern... | lib/classes/tts_engines/bark.py | 26 | Python | 0.857 | refactor | 654 | 47 | 47 | false | v25.12.33 | 1,501 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
sentences_dir.glob(f"*.{default_audio_proc_format}"),
key=lambda p: int(p.stem)
)
all_sentences_length = len(all_sentences)
audio_files_length = len(audio_files)
expected_indices = list(range(audio_files_length))
actual_indices ... | The `file` variable is a `Path` object from the `glob` operation, but `get_audio_duration` expects a string parameter according to its type annotation. While Python's subprocess module can handle Path objects in many cases, it's better to explicitly convert it to ensure compatibility: `duration = get_audio_duration(str... | key=lambda p: int(p.stem)
)
all_sentences_length = len(all_sentences)
audio_files_length = len(audio_files)
expected_indices = list(range(audio_files_length))
actual_indices = [int(p.stem) for p in audio_files]
if actual_indices != ... | @@ -451,9 +450,8 @@ def _build_vtt_file(self, all_sentences: list, audio_dir: str, vtt_path: str) ->
progress_bar = gr.Progress(track_tqdm=False)
with tqdm(total=audio_files_length, unit='files') as t:
for idx, file in enumerate(audio_files):
- audio = A... | lib/classes/tts_engines/common/utils.py | 26 | Python | 1 | suggestion | 407 | 50 | 48 | false | v25.12.33 | 1,509 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import numpy as np
import torch
import subprocess
import shutil
import json
from torch import Tensor
from typing import Any, Union
from scipy.io import wavfile as wav
from scipy.signal import find_peaks
from lib.classes.subprocess_pipe import SubprocessPipe
def detect_gender(voice_path:str)->str|None:
try:
... | The function `get_audio_duration` is being added here, but this function already exists in this file at line 63. This creates a duplicate function definition where the second definition will shadow the first one. The existing function should be removed or this addition should be reconsidered to avoid the duplication. | return audio_data.size > 0
except ImportError:
pass
return False
def get_audio_duration(filepath:str)->float:
try:
ffprobe_cmd = [
shutil.which('ffprobe'),
'-v', 'error',
'-show_entries', 'format=duration',
'-of', 'json',
... | @@ -122,4 +122,26 @@ def is_audio_data_valid(audio_data:Any)->bool:
return audio_data.size > 0
except ImportError:
pass
- return False
\ No newline at end of file
+ return False
+
+def get_audio_duration(filepath:str)->float:
+ try:
+ ffprobe_cmd = [
+ shutil.wh... | lib/classes/tts_engines/common/audio.py | 26 | Python | 0.643 | refactor | 318 | 125 | 26 | false | v25.12.33 | 1,509 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import numpy as np
import torch
import subprocess
import shutil
import json
from torch import Tensor
from typing import Any, Union
from scipy.io import wavfile as wav
from scipy.signal import find_peaks
from lib.classes.subprocess_pipe import SubprocessPipe
def detect_gender(voice_path:str)->str|None:
try:
... | The `DependencyError` class is being called but is not imported in this file. `DependencyError` is defined in `lib.core` but is not exported in `lib/__init__.py`, so the `from lib import *` statement does not make it available. This will cause a `NameError` at runtime when this exception path is triggered. Consider eit... | return audio_data.numel() > 0
if isinstance(audio_data, (list, tuple)):
return len(audio_data) > 0
try:
if isinstance(audio_data, np.ndarray):
return audio_data.size > 0
except ImportError:
pass
return False
def get_audio_duration(filepath:str)->float:
... | @@ -122,4 +122,26 @@ def is_audio_data_valid(audio_data:Any)->bool:
return audio_data.size > 0
except ImportError:
pass
- return False
\ No newline at end of file
+ return False
+
+def get_audio_duration(filepath:str)->float:
+ try:
+ ffprobe_cmd = [
+ shutil.wh... | lib/classes/tts_engines/common/audio.py | 26 | Python | 1 | bug | 566 | 125 | 31 | false | v25.12.33 | 1,509 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
else:
trim_audio_buffer = 0.002
if part.endswith("'"):
part = part[:-1]
speaker_argument = {}
not_supported_punc_pattern = re.compile(r... | Inconsistent indentation: this line has one extra space compared to the dtype parameter below and compared to similar code in other TTS engine files (xtts.py, tacotron.py, fairseq.py, bark.py). The indentation should match the dtype parameter on the next line.
```suggestion
devic... | return False
else:
trim_audio_buffer = 0.002
if part.endswith("'"):
part = part[:-1]
speaker_argument = {}
not_supported_punc_pattern = re.compile(r... | @@ -90,6 +90,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
)
else:
with torch.autocast(
+ device_type=device, | lib/classes/tts_engines/yourtts.py | 26 | Python | 1 | suggestion | 338 | 51 | 51 | false | v25.12.33 | 1,511 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if part.endswith("'"):
part = part[:-1]
speaker_argument = {}
if self._set_voice():
if self.session['language'] == 'eng' and 'vctk/vits' in self.models['internal']['sub']:
... | Inconsistent indentation: this line has one extra space compared to the dtype parameter below and compared to similar code in other TTS engine files (xtts.py, tacotron.py, fairseq.py, bark.py). The indentation should match the dtype parameter on the next line.
```suggestion
d... | if part.endswith("'"):
part = part[:-1]
speaker_argument = {}
if self._set_voice():
if self.session['language'] == 'eng' and 'vctk/vits' in self.models['internal']['sub']:
... | @@ -103,6 +103,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
)
else:
with torch.autocast(
+ device_type=device, | lib/classes/tts_engines/vits.py | 26 | Python | 1 | suggestion | 342 | 51 | 51 | false | v25.12.33 | 1,511 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
source_wav=source_wav,
target_wav=target_wav
)
self.engine_zs.to(devices['CPU']['proc'])
else:
error... | Inconsistent indentation: this line has one extra space compared to the dtype parameter below and compared to similar code in other TTS engine files (xtts.py, tacotron.py, fairseq.py, bark.py). The indentation should match the dtype parameter on the next line.
```suggestion
d... | audio_part = self.engine_zs.voice_conversion(
source_wav=source_wav,
target_wav=target_wav
)
self.engine_zs.to(devices['CPU']['proc'... | @@ -175,6 +176,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
)
else:
with torch.autocast(
+ device_type=device, | lib/classes/tts_engines/vits.py | 26 | Python | 1 | suggestion | 342 | 51 | 51 | false | v25.12.33 | 1,511 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import os
import numpy as np
import regex as re
import scipy.fftpack
import soundfile as sf
import subprocess
import shutil
import json
from typing import Any
from io import BytesIO
from pydub import AudioSegment, silence
from pydub.silence import detect_silence
from lib.classes.tts_engines.common.preset_loader impor... | soundfile (imported as sf) is imported but not used anywhere in the code. This unused import should be removed to keep the codebase clean.
```suggestion
import os, subprocess, shutil, json, numpy as np, regex as re, scipy.fftpack, gradio as gr
``` | import os, subprocess, shutil, json, numpy as np, regex as re, scipy.fftpack, soundfile as sf, gradio as gr
from typing import Any
from io import BytesIO
from pydub import AudioSegment, silence
from pydub.silence import detect_nonsilent
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
from... | @@ -1,16 +1,9 @@
-import os
-import numpy as np
-import regex as re
-import scipy.fftpack
-import soundfile as sf
-import subprocess
-import shutil
-import json
+import os, subprocess, shutil, json, numpy as np, regex as re, scipy.fftpack, soundfile as sf, gradio as gr | lib/classes/voice_extractor.py | 1 | Python | 0.857 | suggestion | 247 | 26 | 26 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
min_required_duration = 20000 if self.session['tts_engine'] == TTS_ENGINES['BARK'] else 12000
msg = f"Removing long pauses..."
print(msg)
self._remove_silences(audio, silence_threshold)
if total_duration <= min_required_duration:
msg = f"Audio ... | The progress bar percentage calculation is incorrect. Division of integers should use floating-point arithmetic to get a proper percentage. This will always result in 0 or 1, not a percentage between 0 and 100. Should use (i / max(1, total - 1)) * 100 or similar.
```suggestion
percent = int((i / max(1, ... | DependencyError(e)
return 0
except Exception as e:
error = f"get_audio_duration() Error: Failed to process {filepath}: {e}"
print(error)
return 0
def _remove_silences(self, audio:AudioSegment, silence_threshold:int, min_silence_len:int=200, keep_s... | @@ -216,8 +141,96 @@ def _get_audio_duration(self, filepath:str)->float:
print(error)
return 0
+ def _remove_silences(self, audio:AudioSegment, silence_threshold:int, min_silence_len:int=200, keep_silence:int=300)->AudioSegment:
+ msg = "Removing empty audio..."
+ print(msg)... | lib/classes/voice_extractor.py | 26 | Python | 0.857 | bug | 342 | 51 | 51 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if next_starts:
new_end = min(next_starts)
else:
new_end = total_duration
best_start, best_end = new_start, new_end
else:
best_start = 0
best_end = total_du... | The progress bar percentage calculation is incorrect. Division of integers should use floating-point arithmetic to get a proper percentage. This will always result in 0 or 1, not a percentage between 0 and 100. Should use (i / max(1, total_steps - 1)) * 100 or similar.
```suggestion
percent = in... | self.progress_bar(0, desc=msg)
if total_duration <= min_required_duration:
msg = f"Audio is only {total_duration / 1000:.2f}s long; skipping audio trimming..."
return True, msg
if total_duration > min_required_duration * 2:
window =... | @@ -216,8 +141,96 @@ def _get_audio_duration(self, filepath:str)->float:
print(error)
return 0
+ def _remove_silences(self, audio:AudioSegment, silence_threshold:int, min_silence_len:int=200, keep_silence:int=300)->AudioSegment:
+ msg = "Removing empty audio..."
+ print(msg)... | lib/classes/voice_extractor.py | 26 | Python | 0.857 | bug | 362 | 51 | 51 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.samplerate = models[session['fine_tuned']]['samplerate']
def _validate_format(self)->tuple[bool,str]:
file_extension = os.path.splitext(self.voice_file)[1].lower()
if file_extension in voice_formats:
msg = 'Input file is valid'
return True,msg
error = f'... | Logic error: When the WAV file is not created or is empty (line 52-53), the code continues to the else block (line 54) which checks if proc is successful. This means if the file doesn't exist, the error won't be returned immediately. The return statement is missing after line 53, causing the error to be overwritten or ... | if file_extension in voice_formats:
msg = 'Input file is valid'
return True,msg
error = f'Unsupported format: {file_extension}'
return False,error
def _convert2wav(self)->tuple[bool, str]:
try:
msg = 'Convert to WAV...'
print(msg)
... | @@ -38,160 +34,89 @@ def _validate_format(self)->tuple[bool,str]:
if file_extension in voice_formats:
msg = 'Input file is valid'
return True,msg
- error = f'Unsupported file format: {file_extension}. Supported formats are: {", ".join(voice_formats)}'
+ error = f'Unsuppo... | lib/classes/voice_extractor.py | 26 | Python | 0.571 | suggestion | 325 | 51 | 51 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import os
import numpy as np
import regex as re
import scipy.fftpack
import soundfile as sf
import subprocess
import shutil
import json
from typing import Any
from io import BytesIO
from pydub import AudioSegment, silence
from pydub.silence import detect_silence
from lib.classes.tts_engines.common.preset_loader impor... | Adding gradio as a direct import in the VoiceExtractor class couples this utility class with the GUI framework. This creates an unnecessary dependency where VoiceExtractor cannot be used independently in non-GUI contexts (like CLI tools or tests) without importing gradio. Consider passing a progress callback function i... | import os, subprocess, shutil, json, numpy as np, regex as re, scipy.fftpack, soundfile as sf, gradio as gr
from typing import Any
from io import BytesIO
from pydub import AudioSegment, silence
from pydub.silence import detect_nonsilent
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
from... | @@ -1,16 +1,9 @@
-import os
-import numpy as np
-import regex as re
-import scipy.fftpack
-import soundfile as sf
-import subprocess
-import shutil
-import json
+import os, subprocess, shutil, json, numpy as np, regex as re, scipy.fftpack, soundfile as sf, gradio as gr | lib/classes/voice_extractor.py | 1 | Python | 0.5 | refactor | 373 | 26 | 26 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import os
import platform
import tempfile
import sys
# ---------------------------------------------------------------------
# Global configuration
# ---------------------------------------------------------------------
min_python_version = (3,10)
max_python_version = (3,12)
tmp_dir = os.path.abspath('tmp'... | While consolidating imports on one line is valid Python, having multiple imports on a single line reduces code readability and makes it harder to track changes in version control. PEP 8 recommends keeping imports on separate lines for better readability and maintainability.
```suggestion
import os
import platform
impor... | import os, platform, tempfile, sys
# ---------------------------------------------------------------------
# Global configuration
# ---------------------------------------------------------------------
min_python_version = (3,10)
max_python_version = (3,12)
tmp_dir = os.path.abspath('tmp')
tempfile.tempdir =... | @@ -1,7 +1,4 @@
-import os
-import platform
-import tempfile
-import sys
+import os, platform, tempfile, sys
| lib/conf.py | 1 | Python | 0.857 | suggestion | 345 | 26 | 26 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import numpy as np
import torch
import subprocess
import shutil
import json
from torch import Tensor
from typing import Any, Union
from scipy.io import wavfile as wav
from scipy.signal import find_peaks
from lib.classes.subprocess_pipe import SubprocessPipe
def detect_gender(voice_path:str)->str|None:
try:
... | While consolidating imports on one line is valid Python, having multiple imports on a single line reduces code readability and makes it harder to track changes in version control. PEP 8 recommends keeping imports on separate lines for better readability and maintainability.
```suggestion
import torch
import subprocess
... | import torch, subprocess, shutil, json, numpy as np
from torch import Tensor
from typing import Any, Union
from scipy.io import wavfile as wav
from scipy.signal import find_peaks
from lib.classes.subprocess_pipe import SubprocessPipe
def detect_gender(voice_path:str)->str|None:
try:
samplerate, signal = ... | @@ -1,8 +1,4 @@
-import numpy as np
-import torch
-import subprocess
-import shutil
-import json
+import torch, subprocess, shutil, json, numpy as np | lib/classes/tts_engines/common/audio.py | 1 | Python | 0.857 | suggestion | 368 | 26 | 26 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
gpt_cond_latent, speaker_embedding = self.xtts_speakers[default_engine_settings[xtts]['voices'][speaker]].values()
else:
gpt_cond_latent, speaker_embedding = engine.get_conditioning_latents(audio_path=[voice_path], librosa_trim_db=30, load_... | The first torch.no_grad() context (lines 293-296) loads the engine to device, then immediately moves it to CPU without doing any computation. This appears to be dead code - the engine is loaded and immediately unloaded before any inference is performed. This wastes GPU memory allocation cycles and serves no purpose. | if speaker in default_engine_settings[xtts]['voices'].keys():
gpt_cond_latent, speaker_embedding = self.xtts_speakers[default_engine_settings[xtts]['voices'][speaker]].values()
else:
gpt_cond_latent, speaker_embeddin... | @@ -290,16 +291,33 @@ def _check_xtts_builtin_speakers(self, voice_path:str, speaker:str)->str|bool:
if self.session.get(key) is not None
}
with torch.no_grad():
- device = devices['CUDA']['proc'] if self.session['... | lib/classes/tts_engines/common/utils.py | 26 | Python | 0.643 | suggestion | 317 | 51 | 51 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import os
import numpy as np
import regex as re
import scipy.fftpack
import soundfile as sf
import subprocess
import shutil
import json
from typing import Any
from io import BytesIO
from pydub import AudioSegment, silence
from pydub.silence import detect_silence
from lib.classes.tts_engines.common.preset_loader impor... | scipy.fftpack is imported but no longer used in the code. The FFT computation was changed to use numpy.fft.rfft (line 198) instead. This unused import should be removed to keep the codebase clean.
```suggestion
import os, subprocess, shutil, json, numpy as np, regex as re, soundfile as sf, gradio as gr
``` | import os, subprocess, shutil, json, numpy as np, regex as re, scipy.fftpack, soundfile as sf, gradio as gr
from typing import Any
from io import BytesIO
from pydub import AudioSegment, silence
from pydub.silence import detect_nonsilent
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
from... | @@ -1,16 +1,9 @@
-import os
-import numpy as np
-import regex as re
-import scipy.fftpack
-import soundfile as sf
-import subprocess
-import shutil
-import json
+import os, subprocess, shutil, json, numpy as np, regex as re, scipy.fftpack, soundfile as sf, gradio as gr | lib/classes/voice_extractor.py | 1 | Python | 0.857 | suggestion | 307 | 26 | 26 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
print(report)
if status:
msg = 'Background noise or music detected. Proceeding voice extraction...'
else:
msg = 'No background noise or music detected. Skipping separation...'
return True,status,msg
except Exception as e:
... | Typo in message: 'exctracted' should be 'extracted'
```suggestion
msg = 'Voice extracted!'
``` | msg = 'Background detected...'
else:
msg = 'No background detected'
return True, status, msg
except Exception as e:
error = f'_detect_background() error: {e}'
print(error)
return False, False, error
def _demucs_voic... | @@ -38,160 +34,89 @@ def _validate_format(self)->tuple[bool,str]:
if file_extension in voice_formats:
msg = 'Input file is valid'
return True,msg
- error = f'Unsupported file format: {file_extension}. Supported formats are: {", ".join(voice_formats)}'
+ error = f'Unsuppo... | lib/classes/voice_extractor.py | 26 | Python | 0.786 | refactor | 110 | 51 | 51 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import os
import numpy as np
import regex as re
import scipy.fftpack
import soundfile as sf
import subprocess
import shutil
import json
from typing import Any
from io import BytesIO
from pydub import AudioSegment, silence
from pydub.silence import detect_silence
from lib.classes.tts_engines.common.preset_loader impor... | While consolidating imports on one line is valid Python, having 8+ imports on a single line significantly reduces code readability and makes it harder to track changes in version control. PEP 8 recommends keeping imports on separate lines for better readability and maintainability.
```suggestion
import os
import subpro... | import os, subprocess, shutil, json, numpy as np, regex as re, scipy.fftpack, soundfile as sf, gradio as gr
from typing import Any
from io import BytesIO
from pydub import AudioSegment, silence
from pydub.silence import detect_nonsilent
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
from... | @@ -1,16 +1,9 @@
-import os
-import numpy as np
-import regex as re
-import scipy.fftpack
-import soundfile as sf
-import subprocess
-import shutil
-import json
+import os, subprocess, shutil, json, numpy as np, regex as re, scipy.fftpack, soundfile as sf, gradio as gr | lib/classes/voice_extractor.py | 1 | Python | 0.857 | suggestion | 456 | 26 | 26 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import torch
import librosa
import threading
from pyannote.audio import Model
from pyannote.audio.pipelines import VoiceActivityDetection
from lib.conf import tts_dir
from lib.conf_models import default_voice_detection_model
_PIPELINE_CACHE = {}
_PIPELINE_LOCK = threading.Lock()
class BackgroundDetector:
def _... | While consolidating imports on one line is valid Python, having multiple imports on a single line reduces code readability and makes it harder to track changes in version control. PEP 8 recommends keeping imports on separate lines for better readability and maintainability.
```suggestion
import torch
import librosa
imp... | import torch, librosa, threading
from pyannote.audio import Model
from pyannote.audio.pipelines import VoiceActivityDetection
from lib.conf import tts_dir
from lib.conf_models import default_voice_detection_model
_PIPELINE_CACHE = {}
_PIPELINE_LOCK = threading.Lock()
class BackgroundDetector:
def __init__(self,... | @@ -1,13 +1,10 @@
-import torch
-import librosa
-import threading
+import torch, librosa, threading | lib/classes/background_detector.py | 1 | Python | 1 | suggestion | 337 | 26 | 26 | false | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
#"xtts_codec_temperature": float,
"xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight"... | The device_type parameter passed to torch.autocast may be invalid. When self.session['device'] is 'rocm', it will be passed directly to torch.autocast, but 'rocm' is not a valid device_type for torch.autocast. PyTorch's autocast only accepts 'cpu', 'cuda', 'xpu', and optionally 'mps'. Consider mapping 'rocm' to 'cuda' ... | "xtts_length_penalty": float,
"xtts_num_beams": int,
"xtts_repetition_penalty": float,
#"xtts_cvvp_weight": float,
"xtts_top_k": int,
... | @@ -123,6 +122,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
)
else:
with torch.autocast(
+ device_type=device, | lib/classes/tts_engines/xtts.py | 26 | Python | 1 | suggestion | 850 | 51 | 51 | false | v26.1.12 | 1,515 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
trim_audio_buffer = 0.004
if part.endswith("'"):
part = part[:-1]
if self.session['language'] in ['zho', 'jpn', 'kor', 'tha', 'lao', 'mya', 'khm']:
not_supported_punc_pattern = re.compile(r'\p... | The device_type parameter passed to torch.autocast may be invalid. When self.session['device'] is 'rocm', it will be passed directly to torch.autocast, but 'rocm' is not a valid device_type for torch.autocast. PyTorch's autocast only accepts 'cpu', 'cuda', 'xpu', and optionally 'mps'. Consider mapping 'rocm' to 'cuda' ... | trim_audio_buffer = 0.004
if part.endswith("'"):
part = part[:-1]
if self.session['language'] in ['zho', 'jpn', 'kor', 'tha', 'lao', 'mya', 'khm']:
not_supported_punc_pattern = re.compile(r'\p... | @@ -119,6 +119,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
)
else:
with torch.autocast(
+ device_type=device, | lib/classes/tts_engines/tacotron.py | 26 | Python | 1 | suggestion | 595 | 51 | 51 | false | v26.1.12 | 1,515 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if next_starts:
new_end = min(next_starts)
else:
new_end = total_duration
best_start, best_end = new_start, new_end
else:
best_start = 0
best_end = total_du... | The percent calculation will always return 0 or 1 because it uses integer division. It should be multiplied by 100 to get a proper percentage value, or use float division.
```suggestion
percent = i / max(1, total_steps - 1)
``` | self.progress_bar(0, desc=msg)
if total_duration <= min_required_duration:
msg = f"Audio is only {total_duration / 1000:.2f}s long; skipping audio trimming..."
return True, msg
if total_duration > min_required_duration * 2:
window =... | @@ -216,8 +141,96 @@ def _get_audio_duration(self, filepath:str)->float:
print(error)
return 0
+ def _remove_silences(self, audio:AudioSegment, silence_threshold:int, min_silence_len:int=200, keep_silence:int=300)->AudioSegment:
+ msg = "Removing empty audio..."
+ print(msg)... | lib/classes/voice_extractor.py | 26 | Python | 0.857 | suggestion | 251 | 51 | 51 | false | v26.1.12 | 1,515 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
def _convert2wav(self)->tuple[bool, str]:
try:
self.wav_file = os.path.join(self.session['voice_dir'], f'{self.voice_name}.wav')
cmd = [
shutil.which('ffmpeg'), '-hide_banner', '-nostats', '-i', self.voice_file,
'-ac', '1', '-y', self.wav_file
... | The error handling logic is incorrect. When the file doesn't exist or is empty (line 52-53), an error message is assigned but the function doesn't return False immediately. The code continues to line 54 and will fall through to return False, error at line 68, but only if proc evaluated to a falsy value or an exception ... | print(msg)
if self.is_gui_process:
self.progress_bar(1, desc=msg)
self.wav_file = os.path.join(self.session['voice_dir'], f'{self.voice_name}.wav')
cmd = [
shutil.which('ffmpeg'), '-hide_banner', '-nostats', '-i', self.voice_file,
... | @@ -38,160 +34,89 @@ def _validate_format(self)->tuple[bool,str]:
if file_extension in voice_formats:
msg = 'Input file is valid'
return True,msg
- error = f'Unsupported file format: {file_extension}. Supported formats are: {", ".join(voice_formats)}'
+ error = f'Unsuppo... | lib/classes/voice_extractor.py | 26 | Python | 0.571 | bug | 366 | 51 | 51 | false | v26.1.12 | 1,515 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if part.endswith("'"):
part = part[:-1]
speaker_argument = {}
if self._set_voice():
if self.session['language'] == 'eng' and 'vctk/vits' in self.models['internal']['sub']:
... | The device_type parameter passed to torch.autocast may be invalid. When self.session['device'] is 'rocm', it will be passed directly to torch.autocast, but 'rocm' is not a valid device_type for torch.autocast. PyTorch's autocast only accepts 'cpu', 'cuda', 'xpu', and optionally 'mps'. Consider mapping 'rocm' to 'cuda' ... | if part.endswith("'"):
part = part[:-1]
speaker_argument = {}
if self._set_voice():
if self.session['language'] == 'eng' and 'vctk/vits' in self.models['internal']['sub']:
... | @@ -103,6 +103,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
)
else:
with torch.autocast(
+ device_type=device, | lib/classes/tts_engines/vits.py | 26 | Python | 1 | suggestion | 605 | 51 | 51 | false | v26.1.12 | 1,515 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.