isl-org / DPT

Dense Prediction Transformers
MIT License
1.92k stars 248 forks source link

Conversion to coreML #44

Open abhimanyuchadha96 opened 2 years ago

abhimanyuchadha96 commented 2 years ago

I am trying to convert the DPT_Scriptable model to a coreML model but am unable to due to this error.

RuntimeError: NYI: Named tensors are not supported with the tracer

Script that I am running:-

` model = DPTDepthModel( path=model_path, backbone="vitl16_384", non_negative=True, enable_attention_hooks=False, ) model.to(device); model.eval();

from DPT.util import io img = io.read_image('/content/dog.jpg') img_input = transform({"image": img})["image"] sample = torch.from_numpy(img_input).to(device).unsqueeze(0) sample = sample.to(memory_format=torch.channels_last)

tracedModel = torch.jit.trace(model.forward, example_inputs=sample); `

quic-ssiddego commented 2 years ago

Hi, Even I tried a jit trace and hit this issue, @abhimanyuchadha96 were you able to get around this?