Giter Site home page Giter Site logo

onnx-plaidml's Issues

About Version-5 reshape

I run onnx-plaidml on my model and got an error:
“Version-5 reshape() is not yet implemented by the PlaidML ONNX backend”
I find it caused by the function pixelshuffle I used. Do you have an incomplete implement of this operation?

ImportError: cannot import name 'onnx_pb2'

Having trouble getting set up. These are the exact commands I run:

conda install -q -y -c conda-forge onnx
pip install -q onnx-plaidml
plaidml-setup

When in plaidml-setup:

Default Config Devices:
   opencl_nvidia_tesla_k20m.0 : NVIDIA Corporation Tesla K20m (OpenCL)

Experimental Config Devices:
   llvm_cpu.0 : CPU (LLVM)

Using experimental devices can cause poor performance, crashes, and other nastiness.

Enable experimental device support? (y,n)[n]:

If I enter n then:

No devices available in chosen config. Rerun plaidml-setup.

So I enter y and it chooses the CPU.

Then from the python toplevel:

>>> import onnx
>>> import onnx_plaidml.backend

Produces:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/miniconda3/envs/plaidml-venv/lib/python3.5/site-packages/onnx_plaidml/backend.py", line 18, in <module>
    from onnx import onnx_pb2
ImportError: cannot import name 'onnx_pb2'

I noticed that onnx_pb2 direct usage has been removed from ONNX onnx/onnx#292. Should I downgrade to a specific version of ONNX?

Thanks

error on trying in "import onnx_plaidml.backend"

Traceback (most recent call last):
File "tesst.py", line 2, in
import onnx_plaidml.backend
File "D:\Anaconda3\envs\deeplab\lib\site-packages\onnx_plaidml\backend.py", line 18, in
from onnx import onnx_pb2
ImportError: cannot import name 'onnx_pb2'

plaidbench can't find onnx-plaidml

How to reproduce (Antergos / Arch Linux):

  1. Create a virtual environment and activate it.
  2. Install plaidml-keras, plaidbench, and onnx-plaidml in the virtual environment.
  3. Run plaidml-setup.
  4. plaidbench --blanket-run onnx.
plaidbench --blanket-run onnx
Error: Missing needed packages for benchmark; to fix, pip install onnx-plaidml

Version-10 not supported

I got the following error

(tensorflow-1.12.0-src) kaos-new:plaid-maskrcnn sam$ python dirty.py 
Traceback (most recent call last):
  File "dirty.py", line 49, in <module>
    rep = onnx_plaidml.backend.prepare(model, device='GPU')
  File "/Users/sam/dev/virtualenv/tensorflow-1.12.0-src/lib/python3.6/site-packages/onnx_plaidml/backend.py", line 249, in prepare
    ops = _load_ops(model.opset_import)
  File "/Users/sam/dev/virtualenv/tensorflow-1.12.0-src/lib/python3.6/site-packages/onnx_plaidml/backend.py", line 77, in _load_ops
    domain, version)), None)
  File "<string>", line 3, in raise_from
NotImplementedError: ""/version=10" is not implemented by the PlaidML ONNX backend

When running the following test code


import onnx
import onnx_plaidml.backend
import onnx.numpy_helper

data_path = "//Users/sam/dev/plaid-maskrcnn/test_data_set_0/input_0.pb"
tensor = onnx.TensorProto()
with open(data_path, 'rb') as f:
	tensor.ParseFromString(f.read())
x = onnx.numpy_helper.to_array(tensor)
model_path = "/Users/sam/dev/plaid-maskrcnn/mask_rcnn_R_50_FPN_1x.onnx"
model = onnx.load(model_path)


import numpy as np
from PIL import Image

def preprocess(image):
    # Resize
    ratio = 800.0 / min(image.size[0], image.size[1])
    image = image.resize((int(ratio * image.size[0]), int(ratio * image.size[1])), Image.BILINEAR)

    # Convert to BGR
    image = np.array(image)[:, :, [2, 1, 0]].astype('float32')

    # HWC -> CHW
    image = np.transpose(image, [2, 0, 1])

    # Normalize
    mean_vec = np.array([102.9801, 115.9465, 122.7717])
    for i in range(image.shape[0]):
        image[i, :, :] = image[i, :, :] - mean_vec[i]

    # Pad to be divisible of 32
    import math
    padded_h = int(math.ceil(image.shape[1] / 32) * 32)
    padded_w = int(math.ceil(image.shape[2] / 32) * 32)

    padded_image = np.zeros((3, padded_h, padded_w), dtype=np.float32)
    padded_image[:, :image.shape[1], :image.shape[2]] = image
    image = padded_image

    return image

img = Image.open('/Users/sam/Downloads/VER01_010_plateD_v0001.1008.png')
img_data = preprocess(img)


rep = onnx_plaidml.backend.prepare(model, device='GPU')
for batch in range(1):
    data = img['inputs'][batch, :]
    output = rep.run([data])
    print(output)

Just trying to see if it possible to run maskrcnn on plaidml for GPU acceleration on a non NVIDIA GPU.

But it seems that onnx-plaidml is no longer maintained.

Upsample" is not implemented by the PlaidML ONNX backend

First of all: thanks for plaidm, big fan of plaidml-keras.

I am trying to load a model i exported from pytorch (2d model from https://github.com/1adrianb/face-alignment).
After downgrading to pytorch 0.4.1, because onnx-plaidml doesn't support the current model 9 which pytorch.onnx.export currently provides, i now run into this error:

Traceback:
Traceback (most recent call last):
 File "/align/_base.py", line 91, in run
 self.align(*args, **kwargs)
 File "/align/fan.py", line 52, in align
 super().align(*args, **kwargs)
 File "/align/_base.py", line 81, in align
 self.initialize(*args, **kwargs)
 File "/align/fan.py", line 45, in initialize
 self.model = FAN(self.model_path, ratio=tf_ratio)
 File "/align/fan.py", line 221, in __init__
 self.graph = self.load_graph()
 File "/align/fan.py", line 236, in load_graph
 return onnx_plaidml.backend.prepare(model)
 File "/home/nope/.conda/envs/oxxn/lib/python3.7/site-packages/onnx_plaidml/backend.py", line 274, in prepare
 cls._apply_node(ops, node, bindings)
 File "/home/nope/.conda/envs/oxxn/lib/python3.7/site-packages/onnx_plaidml/backend.py", line 237, in _apply_node
 node.domain, node.op_type)), None)
 File "<string>", line 2, in raise_from
NotImplementedError: ""/"Upsample" is not implemented by the PlaidML ONNX backend

Any chance the "Upsample" layer could be implemented ?

run_model() missing 1 required positional argument: 'inputs'

I was trying to run the example in README, but there is an error:

Traceback (most recent call last):
  File "./plaidml-test.py", line 18, in <module>
    output = onnx_plaidml.backend.run_model(model, [data])
  File "/home/hsu.hau/.virtualenvs/ml/lib/python3.5/site-packages/onnx_plaidml/backend.py", line 166, in run_model
    return super(PlaidMLBackend, cls).run_model(model, device=device, **kwargs)
TypeError: run_model() missing 1 required positional argument: 'inputs'

And I have to modify the code onnx_plaidml/backend.py to avoid this error:

166c166
<         return super(PlaidMLBackend, cls).run_model(model, inputs, device=device, **kwargs)
---
>         return super(PlaidMLBackend, cls).run_model(model, device=device, **kwargs)

Is that a bug or I did something wrong?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.