internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: voicepaw/so-vits-svc-fork

Issue:
False error messages
**Describe the bug**
When I run gui on the latest version of fork, I get 3 errors after completing the inference, but the file is saved and there are really no errors

**To Reproduce**
Run inference on the latest version of fork

**Additional context**
Errors:
![WindowsTerminal_pVYd49jSQJ](https://user-images.githubusercontent.com/43951115/232249101-1ad68792-f65a-4242-90e2-e8e37922919d.png)




Discussion:
P.S: This did not happen in previous versions

Resolving patch:
diff --git a/src/so_vits_svc_fork/gui.py b/src/so_vits_svc_fork/gui.py
--- a/src/so_vits_svc_fork/gui.py
+++ b/src/so_vits_svc_fork/gui.py
@@ -9,7 +9,7 @@
 import sounddevice as sd
 import soundfile as sf
 import torch
-from pebble import ProcessFuture, ProcessPool
+from pebble import ProcessFuture, ThreadPool
 from tqdm.tk import tqdm_tk
 
 from .utils import ensure_pretrained_model, get_optimal_device
@@ -513,7 +513,9 @@ def apply_preset(name: str) -> None:
     del default_name
     update_speaker()
     update_devices()
-    with ProcessPool(max_workers=1) as pool:
+    # with ProcessPool(max_workers=1) as pool:
+    # with ProcessPool(max_workers=1, context="spawn") as pool:
+    with ThreadPool(max_workers=1) as pool:
         future: None | ProcessFuture = None
         infer_futures: set[ProcessFuture] = set()
         while True:
@@ -673,18 +675,18 @@ def apply_preset(name: str) -> None:
                 except Exception as e:
                     LOG.exception(e)
             if future is not None and future.done():
-                LOG.error("Error in realtime: ")
                 try:
                     future.result()
                 except Exception as e:
+                    LOG.error("Error in realtime: ")
                     LOG.exception(e)
                 future = None
             for future in copy(infer_futures):
                 if future.done():
-                    LOG.error("Error in inference: ")
                     try:
                         future.result()
                     except Exception as e:
+                        LOG.error("Error in inference: ")
                         LOG.exception(e)
                     infer_futures.remove(future)
         if future:


Test patch:
Repository: voicepaw/so-vits-svc-fork

Issue:
ValueError __main__
Got this working twice but cannot get it to run using CUDA. Running into this error when calling train. 

           INFO     [17:56:38] Loaded checkpoint 'logs\44k\G_0.pth' (iteration 0)                           utils.py:257
           INFO     [17:56:38] Loaded checkpoint 'logs\44k\D_0.pth' (iteration 0)                           utils.py:257
INFO: Initializing distributed: GLOBAL_RANK: 0, MEMBER: 1/2
           INFO     [17:56:38] Initializing distributed: GLOBAL_RANK: 0, MEMBER: 1/2                  distributed.py:244
[W ..\torch\csrc\distributed\c10d\socket.cpp:601] [c10d] The client socket has failed to connect to [kubernetes.docker.internal]:49979 (system error: 10049 - The requested address is not valid in its context.).
so-vits-svc-fork\venv\Scripts\python.exe: Error while finding module specification for '__main__' (ValueError: __main__.__spec__ is None)



Discussion:
Was getting the same issue, happens for me if I have CUDA enabled on more than one GPU on the python process sovits is using. I made sure it was only using 1 GPU for CUDA in the Nvidia settings and it's fine now. I can't get multi GPU working though.
Great catch, that worked!
https://github.com/Lightning-AI/lightning/blob/master/src/lightning/fabric/utilities/distributed.py#L257-L257

Resolving patch:
diff --git a/src/so_vits_svc_fork/train.py b/src/so_vits_svc_fork/train.py
--- a/src/so_vits_svc_fork/train.py
+++ b/src/so_vits_svc_fork/train.py
@@ -1,5 +1,6 @@
 from __future__ import annotations
 
+import os
 import warnings
 from logging import getLogger
 from multiprocessing import cpu_count
@@ -10,6 +11,7 @@
 import torch
 from lightning.pytorch.accelerators import MPSAccelerator, TPUAccelerator
 from lightning.pytorch.loggers import TensorBoardLogger
+from lightning.pytorch.strategies.ddp import DDPStrategy
 from lightning.pytorch.tuner import Tuner
 from torch.cuda.amp import autocast
 from torch.nn import functional as F
@@ -75,7 +77,13 @@ def train(
 
     datamodule = VCDataModule(hparams)
     strategy = (
-        "ddp_find_unused_parameters_true" if torch.cuda.device_count() > 1 else "auto"
+        (
+            "ddp_find_unused_parameters_true"
+            if os.name != "nt"
+            else DDPStrategy(find_unused_parameters=True, process_group_backend="gloo")
+        )
+        if torch.cuda.device_count() > 1
+        else "auto"
     )
     LOG.info(f"Using strategy: {strategy}")
     trainer = pl.Trainer(


Test patch:
Repository: voicepaw/so-vits-svc-fork

Issue:
PermissionError: [Errno 13] Permission denied
I'm on Windows 10 WSL2 Ubuntu and this happens when I try to run `svc pre-resample`, what's going on?

Traceback (most recent call last):
  File "/home/fab/miniconda3/envs/sovits/bin/svc", line 5, in <module>
    from so_vits_svc_fork.__main__ import cli
  File "/home/fab/miniconda3/envs/sovits/lib/python3.10/site-packages/so_vits_svc_fork/__init__.py", line 5, in <module>
    init_logger()
  File "/home/fab/miniconda3/envs/sovits/lib/python3.10/site-packages/so_vits_svc_fork/logger.py", line 31, in init_logger
    FileHandler(f"{__name__.split('.')[0]}.log"),
  File "/home/fab/miniconda3/envs/sovits/lib/python3.10/logging/__init__.py", line 1169, in __init__
    StreamHandler.__init__(self, self._open())
  File "/home/fab/miniconda3/envs/sovits/lib/python3.10/logging/__init__.py", line 1201, in _open
    return open_func(self.baseFilename, self.mode,
PermissionError: [Errno 13] Permission denied: '/home/fab/sovits/so_vits_svc_fork.log'


Discussion:
got this too

Resolving patch:
diff --git a/src/so_vits_svc_fork/logger.py b/src/so_vits_svc_fork/logger.py
--- a/src/so_vits_svc_fork/logger.py
+++ b/src/so_vits_svc_fork/logger.py
@@ -1,14 +1,6 @@
 import os
 import sys
-from logging import (
-    DEBUG,
-    INFO,
-    FileHandler,
-    StreamHandler,
-    basicConfig,
-    captureWarnings,
-    getLogger,
-)
+from logging import DEBUG, INFO, StreamHandler, basicConfig, captureWarnings, getLogger
 from pathlib import Path
 
 from rich.logging import RichHandler
@@ -29,7 +21,7 @@ def init_logger() -> None:
         datefmt="[%X]",
         handlers=[
             StreamHandler() if is_notebook() else RichHandler(),
-            FileHandler(f"{package_name}.log"),
+            # FileHandler(f"{package_name}.log"),
         ],
     )
     if IS_TEST:


Test patch:
Repository: voicepaw/so-vits-svc-fork

Issue:
improve the output  file name options on the GUI
**The new OUTPUT is not convenient:**
The latest update demand for an OUTPUT path and file name.
The old version was much more ideal by default.

If user won't enter anything on the OUTPUT, it will not work, instead an annoying error window popups with explanations of the types accepted. I understand it is now more dynamic but there is no "Factory Default" like it was before.

---
**SOLUTION:**
Please make a "Factory Default" once running the GUI APP with these:

**1** - OUTPUT PATH by default should be the SOURCE path.

**2** - FILE NAME by default should be something like: **"RESULT.wav"** 

**3** - You can keep the POPUP Window to show the accepted file types: 
Just add a small question mark button [?] ❓ next to the Path input box, once clicked it will do whatever it currently do while it says: ".out" 

You may want to consider to change the Window title from "**Error**" to "**Help**" and you can add more text there beside the accepted files, like mini-instructions if needed.

---
**CONCLUSION:**
Instead of having ".out" without an path at all, the solution above should be much more convenient out of the box.

Once again, I hope that my suggestion helps improving the project.
Thanks ahead for your great work on this project🙏 I hope that you will consider this. improvement.


Discussion:
There is still a default output filename that is generated when you select an input filename. Are you saying after you select an input, the output path is not populated? Please include a screen recording and information about what OS you’re running on.
> 
Thanks for the reply 💙 let me try to explain again:

Every time I launch the GUI App, the factory default is always ".out" and I must also select a PATH so it is not working on the source file path by default (as it was before).

I need to set it again every time I launch the GUI App, and it is not as convenient as "RESTULT.wav" for example.

I use Windows 10

Resolving patch:
diff --git a/src/so_vits_svc_fork/gui.py b/src/so_vits_svc_fork/gui.py
--- a/src/so_vits_svc_fork/gui.py
+++ b/src/so_vits_svc_fork/gui.py
@@ -615,8 +615,8 @@ def apply_preset(name: str) -> None:
                 update_speaker()
             elif event == "input_path":
                 # Don't change the output path if it's already set
-                if values["output_path"]:
-                    continue
+                # if values["output_path"]:
+                #     continue
                 # Set a sensible default output path
                 window.Element("output_path").Update(str(get_output_path(input_path)))
             elif event == "infer":


Test patch:
Repository: voicepaw/so-vits-svc-fork

Issue:
Old ckpts are not completely deleted in colab
**Describe the bug**
In Google Colab ckpts are moved to trash, but not completely deleted, so you have to manually delete them, it should be automatically removed from the trash

**To Reproduce**
Start training in colab and wait

**Additional context**
you can implement it this way, we overwrite our ckpt file with 0 bytes and delete it, the file will remain in the trash, but it will no longer take up space
```
filepath = 'drive/MyDrive/so-vits-svc-fork/logs/44k/G_STEPS.pth'
open(filepath, 'w').close()
!rm {filepath} #(or what you use to remove)
```



Discussion:
You can send a PR🙂

Resolving patch:
diff --git a/src/so_vits_svc_fork/utils.py b/src/so_vits_svc_fork/utils.py
--- a/src/so_vits_svc_fork/utils.py
+++ b/src/so_vits_svc_fork/utils.py
@@ -1,6 +1,7 @@
 from __future__ import annotations
 
 import json
+import os
 import re
 import subprocess
 import warnings
@@ -26,6 +27,7 @@
 
 LOG = getLogger(__name__)
 HUBERT_SAMPLING_RATE = 16000
+IS_COLAB = os.getenv("COLAB_RELEASE_TAG", False)
 
 
 def get_optimal_device(index: int = 0) -> torch.device:
@@ -328,6 +330,8 @@ def clean_checkpoints(
         for to_delete in to_delete_list:
             if to_delete.exists():
                 LOG.info(f"Removing {to_delete}")
+                if IS_COLAB:
+                    to_delete.write_text("")
                 to_delete.unlink()
 
 


Test patch:
Repository: voicepaw/so-vits-svc-fork

Issue:
Ensure proper sorting by name for output files
### Is your feature request related to a problem? Please describe.

To enhance readability and ensure proper sorting by name, the numeric part of output file names should have a fixed width. This can be achieved by adding leading zeros to the numeric part, with four digits likely being sufficient.

### Describe alternatives you've considered

I don't have any.

### Additional context

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

### Are you willing to resolve this issue by submitting a Pull Request?

- [X] Yes, I have the time, and I know how to start.
- [ ] Yes, I have the time, but I don't know how to start. I would need guidance.
- [ ] No, I don't have the time, although I believe I could do it if I had the time...
- [ ] No, I don't have the time and I wouldn't even know how to start.


Discussion:

Resolving patch:
diff --git a/src/so_vits_svc_fork/preprocessing/preprocess_speaker_diarization.py b/src/so_vits_svc_fork/preprocessing/preprocess_speaker_diarization.py
--- a/src/so_vits_svc_fork/preprocessing/preprocess_speaker_diarization.py
+++ b/src/so_vits_svc_fork/preprocessing/preprocess_speaker_diarization.py
@@ -52,7 +52,7 @@ def _process_one(
         speaker_count[speaker] += 1
         audio_cut = audio[int(segment.start * sr) : int(segment.end * sr)]
         sf.write(
-            (output_dir / f"{speaker}_{speaker_count[speaker]}.wav"),
+            (output_dir / f"{speaker}_{speaker_count[speaker]:04d}.wav"),
             audio_cut,
             sr,
         )


Test patch:
Repository: voicepaw/so-vits-svc-fork

Issue:
Unable to use svc pre-sd with pyannote.audio 3.1.1
### Describe the bug

To use svc pre-sd for a long audio file with multiple speakers, I followed the [setup guide](https://github.com/voicepaw/so-vits-svc-fork/#before-training) and manually installed pyannote.audio, getting the latest version, 3.1.1.

Attempting to run svc pre-sd triggered the following error messages:

```
Model was trained with pyannote.audio 0.0.1, yours is 3.1.1. Bad things might happen unless you revert pyannote.audio to 0.x.

Model was trained with torch 1.10.0+cu102, yours is 2.2.2+cu121. Bad things might happen unless you revert torch to 1.x.
```

According to [PyPI](https://pypi.org/project/pyannote.audio/3.1.1/), pyannote.audio 3.1.1 works with speaker-diarization-3.1. So, it’s necessary to explicitly specify this version in the code.

### To Reproduce

1. Set up the environment. (I'm using torch 2.2.2+cu121.)
2. Install so-vits-svc-fork and its dependencies.
3. Install pyannote.audio with `pip3 install pyannote-audio`.
4. Prepare your data and organize data folders.
5. Run svc pre-sd with options suited to your data.

### Additional context

_No response_

### Version

4.1.61

### Platform

WSL-Ubuntu 22.04 LTS

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct.

### No Duplicate

- [X] I have checked existing issues to avoid duplicates.


Discussion:

Resolving patch:
diff --git a/src/so_vits_svc_fork/preprocessing/preprocess_speaker_diarization.py b/src/so_vits_svc_fork/preprocessing/preprocess_speaker_diarization.py
--- a/src/so_vits_svc_fork/preprocessing/preprocess_speaker_diarization.py
+++ b/src/so_vits_svc_fork/preprocessing/preprocess_speaker_diarization.py
@@ -30,7 +30,7 @@ def _process_one(
         LOG.warning(f"Failed to read {input_path}: {e}")
         return
     pipeline = Pipeline.from_pretrained(
-        "pyannote/speaker-diarization", use_auth_token=huggingface_token
+        "pyannote/speaker-diarization-3.1", use_auth_token=huggingface_token
     )
     if pipeline is None:
         raise ValueError("Failed to load pipeline")


Test patch:
Repository: python-discord/bot

Issue:
Cog load with duplicate command reporting wrong error
**Originally posted by Scragly:**

In the `cogs` extension module, there's a `try: except ClientException`. The reason for the error is hardcoded, assuming that it raises only when a setup function does not exist.

[Click here to view the relevant code.](https://gitlab.com/python-discord/projects/bot/blob/184b6d51e44915319e09b1bdf24ee26541391350/bot/cogs/cogs.py#L80-83)

Unfortunately, the same exception will also raise down the stack in `bot.add_cog` when a command within the cog has a name that's already existing in commands, conflicting and raising the exception.

To avoid incorrect errors being reported/logged, and to prevent confusion during debugging, it might be best to simply remove the `except ClientException` block and let it fall down into the catchall `except Exception as e` block which prints the exception details as given.

Feel free to comment better suggestions, of course. 

This will be something for after the migration over to GitHub, hence why it's an Issue, rather than a quick MR.


Discussion:

Resolving patch:
diff --git a/bot/cogs/cogs.py b/bot/cogs/cogs.py
--- a/bot/cogs/cogs.py
+++ b/bot/cogs/cogs.py
@@ -1,7 +1,7 @@
 import logging
 import os
 
-from discord import ClientException, Colour, Embed
+from discord import Colour, Embed
 from discord.ext.commands import Bot, Context, group
 
 from bot.constants import (
@@ -77,10 +77,6 @@ async def load_command(self, ctx: Context, cog: str):
             if full_cog not in self.bot.extensions:
                 try:
                     self.bot.load_extension(full_cog)
-                except ClientException:
-                    log.error(f"{ctx.author} requested we load the '{cog}' cog, "
-                              "but that cog doesn't have a 'setup()' function.")
-                    embed.description = f"Invalid cog: {cog}\n\nCog does not have a `setup()` function"
                 except ImportError:
                     log.error(f"{ctx.author} requested we load the '{cog}' cog, "
                               f"but the cog module {full_cog} could not be found!")


Test patch:
Repository: python-discord/bot

Issue:
Disable all bot commands but !accept in checkpoint
**Originally posted by ByteCommander:**

The #checkpoint channel is where new members have to go to type `!accept` in order to verify they have read the rules and to get access to all other public channels.

Currently, the bot removes all user messages from #checkpoint immediately, to keep it clean. If the user types anything other than `!accept`, they additionally get a warning which self-destructs after short time.

However, other bot commands are still working, and while the user's original command message will be removed, any command responses will still get posted and do not seem to ever get deleted automatically.

![image](https://cdn.discordapp.com/attachments/464905259261755392/503172538910638110/Screenshot_from_2018-10-20_13-46-45.png)

This seems to be a bug that allows people spamming the checkpoint channel to annoy yet to be verified users.

As a solution, all commands except for `!accept` should be entirely disabled in #checkpoint.


Discussion:
**Comment from Johannes Christ:**

This is somewhat annoying, we could use a global check, but that would also render the accept command unusable. Is there a cleaner way than applying a check on every command that isn't `!accept`?

Resolving patch:
diff --git a/bot/cogs/verification.py b/bot/cogs/verification.py
--- a/bot/cogs/verification.py
+++ b/bot/cogs/verification.py
@@ -151,6 +151,17 @@ async def unsubscribe_command(self, ctx: Context, *_):  # We don't actually care
             f"{ctx.author.mention} Unsubscribed from <#{Channels.announcements}> notifications."
         )
 
+    @staticmethod
+    def __global_check(ctx: Context):
+        """
+        Block any command within the verification channel that is not !accept.
+        """
+
+        if ctx.channel.id == Channels.verification:
+            return ctx.command.name == "accept"
+        else:
+            return True
+
 
 def setup(bot):
     bot.add_cog(Verification(bot))


Test patch:
Repository: python-discord/bot

Issue:
!watch alias is not working.
The `!watch` alias broke when we changed the watch command to take a note instead of a channel - this is due to converters in the alias. I'll fix it.


Discussion:

Resolving patch:
diff --git a/bot/cogs/alias.py b/bot/cogs/alias.py
--- a/bot/cogs/alias.py
+++ b/bot/cogs/alias.py
@@ -1,7 +1,7 @@
 import inspect
 import logging
 
-from discord import Colour, Embed, TextChannel, User
+from discord import Colour, Embed, User
 from discord.ext.commands import (
     Command, Context, clean_content, command, group
 )
@@ -71,13 +71,13 @@ async def site_resources_alias(self, ctx):
 
     @command(name="watch", hidden=True)
     async def bigbrother_watch_alias(
-            self, ctx, user: User, channel: TextChannel = None
+            self, ctx, user: User, *, reason: str = None
     ):
         """
         Alias for invoking <prefix>bigbrother watch user [text_channel].
         """
 
-        await self.invoke(ctx, "bigbrother watch", user, channel)
+        await self.invoke(ctx, "bigbrother watch", user, reason=reason)
 
     @command(name="unwatch", hidden=True)
     async def bigbrother_unwatch_alias(self, ctx, user: User):


Test patch:
Repository: python-discord/bot

Issue:
It should be mandatory to add a reason for !bb watch
Leaving it optional means we don't always know why someone was watched. This is important information, so we should make it mandatory instead.


Discussion:
Is this a "write this" issue or "reach consensus then write this" issue?
If someone disagrees, they're welcome to say so. but I think it's a no-brainer.

Resolving patch:
diff --git a/bot/cogs/bigbrother.py b/bot/cogs/bigbrother.py
--- a/bot/cogs/bigbrother.py
+++ b/bot/cogs/bigbrother.py
@@ -216,11 +216,12 @@ async def watched_command(self, ctx: Context, from_cache: bool = True):
 
     @bigbrother_group.command(name='watch', aliases=('w',))
     @with_role(Roles.owner, Roles.admin, Roles.moderator)
-    async def watch_command(self, ctx: Context, user: User, *, reason: str = None):
+    async def watch_command(self, ctx: Context, user: User, *, reason: str):
         """
         Relay messages sent by the given `user` to the `#big-brother-logs` channel
 
-        If a `reason` is specified, a note is added for `user`
+        A `reason` for watching is required, which is added for the user to be watched as a
+        note (aka: shadow warning)
         """
 
         channel_id = Channels.big_brother_logs
@@ -251,10 +252,9 @@ async def watch_command(self, ctx: Context, user: User, *, reason: str = None):
                 reason = data.get('error_message', "no message provided")
                 await ctx.send(f":x: the API returned an error: {reason}")
 
-        # Add a note (shadow warning) if a reason is specified
-        if reason:
-            reason = "bb watch: " + reason  # Prepend for situational awareness
-            await post_infraction(ctx, user, type="warning", reason=reason, hidden=True)
+        # Add a note (shadow warning) with the reason for watching
+        reason = "bb watch: " + reason  # Prepend for situational awareness
+        await post_infraction(ctx, user, type="warning", reason=reason, hidden=True)
 
     @bigbrother_group.command(name='unwatch', aliases=('uw',))
     @with_role(Roles.owner, Roles.admin, Roles.moderator)


Test patch: