artyom-beilis / pytorch_dlprim

DLPrimitives/OpenCL out of tree backend for pytorch
http://blog.dlprimitives.org/
MIT License
227 stars 16 forks source link

The operator 'aten::index_select' is not currently supported on the ocl backend. #44

Open leviathanch opened 8 months ago

leviathanch commented 8 months ago

I've been trying to run TinyBERT with OpenCL as the backend, but it fails because aten::index_select isn't implemented.

Running this code gives me the error message as shown in the attached log file

import torch
torch.ops.load_library("/usr/local/lib/libpt_ocl.so")
torch.ops.load_library("/usr/local/lib/libdlprim_core.so")
torch.utils.rename_privateuse1_backend('ocl')

from transformers import pipeline

pipe = pipeline(
    model="Intel/dynamic_tinybert",
    task="text-generation",
)
pipe.model = pipe.model.to("ocl:0")

out = pipe("Hello world")
print(out)

log.txt

artyom-beilis commented 8 months ago

The error is RuntimeError: Running sums are expected to be present caused by LayerNorm, the index_select is automatically substituted by CPU version.

Nowadays I work on LayerNorm support as it central thing in many implementations