Skip to content

Run with GPU #34

@llbbcc

Description

@llbbcc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions