Minor bug: non-default argument follows default argument; Out of date doc
Cornox opened this issue · comments
Hello,
I've been trying to get inference to run under windows 10, using anaconda but it throws an error:
(bandit) C:\Users\dreiD\Documents\github\bandit>python inference.py C:\Users\dreiD\Documents\github\bandit\expt\dnr-demucs.yaml --ckpt_path=C:\Users\dreiD\Documents\github\bandit\models\dnr-3s-mus64-l1snr-plus.ckpt
File "C:\Users\dreiD\Documents\github\bandit\inference.py", line 139
file_glob: str,
^^^^^^^^^^^^^^
SyntaxError: non-default argument follows default argument
ChatGPT told me to switch some lines around, in inference.py from this:
def inference_multiple(
ckpt_path: str,
model_name: str = None,
file_glob: str,
output_dir: Optional[str],
include_track_name: Optional[bool] = False,
get_residual: bool = False,
get_no_vox_combinations: bool = False,
channel_filter: Optional[Union[int, List[int]]] = None,
) -> None:
#to this:
def inference_multiple(
ckpt_path: str,
file_glob: str, # Non-default argument comes first
output_dir: Optional[str],
model_name: str = None, # Default argument comes after non-default
include_track_name: Optional[bool] = False,
get_residual: bool = False,
get_no_vox_combinations: bool = False,
channel_filter: Optional[Union[int, List[int]]] = None,
) -> None:
but now I'm getting this error:
(bandit) C:\Users\dreiD\Documents\github\bandit>python inference.py C:\Users\dreiD\Documents\github\bandit\expt\dnr-demucs.yaml --ckpt_path=C:\Users\dreiD\Documents\github\bandit\models\dnr-3s-mus64-l1snr-plus.ckpt
C:\Users\dreiD\anaconda3\envs\bandit\lib\site-packages\torch_audiomentations\utils\io.py:27: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call.
torchaudio.set_audio_backend("soundfile")
ERROR: Cannot find key: C:\Users\dreiD\Documents\github\bandit\expt\dnr-demucs.yaml
Usage: inference.py <group|command>
available groups: glob | os | warnings | np | pl | torch | ta | List |
Optional | Dict | Union | fire
available commands: pprint | LightningSystem | read_nested_yaml | tqdm |
inference | inference_multiple
For detailed information on this command, run:
inference.py --help
ChatGPT says I should check if "dnr-demucs.yaml" exists in the following location:
C:\Users\dreiD\Documents\github\bandit\expt\dnr-demucs.yaml
and it does indeed exists.
It further mentions "Check permissions: Ensure that the script has the necessary permissions to access the file."
When right clicking on the "dnr-demucs.yaml" ->properties->security: SYSTEM, my username and admin have all rights set to Allow.
(I did set an environment variable in anaconda, suggested by ChatGPT:
setx PROJECT_ROOT C:\Users\dreiD\Documents\github\bandit)
The first error is my mistake when cleaning up internal paths before releasing it publicly. I'll make a fix.
The second error has nothing to do with whatever ChatGPT is saying.
Obligatory: Please don't just follow ChatGPT instructions without asking yourself why, especially if it's telling you to change security-related settings! Remember that ChatGPT can still be wrong.
You still have to specify the function to call from inference.py. Please follow the help/error prompt. In your case, this probably means calling python inference.py inference
followed by args. My bad for forgetting to update the readme after adding a new convenience function for mass inference. I'll fix it.
Again, ChatGPT can be VERY wrong. Updating security-related options on files from the internet written by someone you don't know (including me) CAN BE VERY DANGEROUS. Please make sure you know the why behind each instruction. DO NOT GIVE FILES EXECUTE PERMISSION UNLESS YOU REALLY TRUST THE SOURCE