Rikorose / DeepFilterNet

Noise supression using deep filtering
https://huggingface.co/spaces/hshr/DeepFilterNet2
Other
2.4k stars 223 forks source link

How to run this on CPU? #455

Closed furqan4545 closed 7 months ago

furqan4545 commented 11 months ago

How to run this on CPU? Like the work is amazing but it is so complex to understand. There is no way to pass an argument to run the model on CPU. IT auto detects the GPU and I tried to disable this behavior but it didn't work. Please help.

jav-ed commented 11 months ago

I am not sure if this will work out, but try to enter the file: "/DeepFilterNet/DeepFilterNet/df/enhance.py" find the method:

def run():
    parser = setup_df_argument_parser()
    parser.add_argument(
        "--no-delay-compensation",
        dest="compensate_delay",
        action="store_false",
        help="Dont't add some paddig to compensate the delay introduced by the real-time STFT/ISTFT implementation.",
    )
....
....

and in here you might want to add something like:

import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'  # -1 means do not use any GPUs

in total, it should look like:

def run():

    # ----------------------- your addition comes here ----------------------- #
    import os
    os.environ['CUDA_VISIBLE_DEVICES'] = '-1'  # -1 means do not use any GPUs
    # ----------------------------- end addition ----------------------------- #

    parser = setup_df_argument_parser()
    parser.add_argument(
        "--no-delay-compensation",
        dest="compensate_delay",
        action="store_false",
        help="Dont't add some paddig to compensate the delay introduced by the real-time STFT/ISTFT implementation.",
    )
...
...

Please, note I have not tried it myself in this way, thus, I can not give you any guarantees.

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.