hidet-org/hidet

[Bug]

Closed this issue · 3 comments

test code is as follows:

#!/usr/bin/python3
import torch

# Define pytorch model
model = torch.hub.load('pytorch/vision:v0.6.0', 'resnet18', pretrained=True).cuda().eval()
x = torch.rand(1, 3, 224, 224).cuda()

# Compile the model through Hidet
# Optional: set optimization options (see our documentation for more details)
#   import hidet
#   hidet.torch.dynamo_config.search_space(2)  # tune each tunable operator
#   hidet.torch.dynamo_config.use_fp16()       # use float16 for acceleration
model_opt = torch.compile(model, backend='hidet')

# Run the optimized model
y = model_opt(x)
Traceback (most recent call last):
  File "./test.py", line 13, in <module>
    model_opt = torch.compile(model, backend='hidet')
  File "/home/user02/.local/lib/python3.8/site-packages/torch/__init__.py", line 1441, in compile
    return torch._dynamo.optimize(backend=backend, nopython=fullgraph, dynamic=dynamic, disable=disable)(model)
  File "/home/user02/.local/lib/python3.8/site-packages/torch/_dynamo/eval_frame.py", line 424, in optimize
    backend = get_compiler_fn(backend)
  File "/home/user02/.local/lib/python3.8/site-packages/torch/_dynamo/eval_frame.py", line 363, in get_compiler_fn
    compiler_fn = lookup_backend(compiler_fn)
  File "/home/user02/.local/lib/python3.8/site-packages/torch/_dynamo/backends/registry.py", line 58, in lookup_backend
    _lazy_import_entry_point(compiler_fn)
  File "/home/user02/.local/lib/python3.8/site-packages/torch/_dynamo/backends/registry.py", line 100, in _lazy_import_entry_point
    eps = [ep for ep in backend_eps[group_name] if ep.name == backend_name]
KeyError: 'torch_dynamo_backends'

May I ask why this error occurs and how to solve it?Thanks.

Hi @MalaJeans , have you installed hidet?

pip install hidet

It's ready to work. Thank you very much!

It's ready to work. Thank you very much!