Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run with GPU #34

Open
llbbcc opened this issue Feb 23, 2024 · 0 comments
Open

Run with GPU #34

llbbcc opened this issue Feb 23, 2024 · 0 comments

Comments

@llbbcc
Copy link

llbbcc commented Feb 23, 2024

We can run the code on the GPU with the following modifications:

pip install onnxruntime-gpu

Modify the following code segment in ./imwatermark/rivaGAN.py

RivaWatermark.encoder = onnxruntime.InferenceSession(
    os.path.join(modelDir, 'rivagan_encoder.onnx'))
RivaWatermark.decoder = onnxruntime.InferenceSession(
    os.path.join(modelDir, 'rivagan_decoder.onnx'))

to

RivaWatermark.encoder = onnxruntime.InferenceSession(
    os.path.join(modelDir, 'rivagan_encoder.onnx'), providers=['CUDAExecutionProvider'])
RivaWatermark.decoder = onnxruntime.InferenceSession(
    os.path.join(modelDir, 'rivagan_decoder.onnx'), providers=['CUDAExecutionProvider'])

Then, you can run the code on the GPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant