question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing compatible torchvision in repository https://developer.intel.com/ipex-whl-stable-xpu

See original GitHub issue
(base) tedliosu@victus-ted:~/Documents/all_git/intel-extension-for-pytorch/docker$ sudo -H ./build.sh
[a bunch of output here]
(base) tedliosu@victus-ted:~/Documents/all_git/intel-extension-for-pytorch/docker$ IMAGE_NAME=intel-extension-for-pytorch:gpu
(base) tedliosu@victus-ted:~/Documents/all_git/intel-extension-for-pytorch/docker$ VIDEO=$(getent group video | sed -E 's,^video:[^:]*:([^:]*):.*$,\1,')
(base) tedliosu@victus-ted:~/Documents/all_git/intel-extension-for-pytorch/docker$ RENDER=$(getent group render | sed -E 's,^render:[^:]*:([^:]*):.*$,\1,')
(base) tedliosu@victus-ted:~/Documents/all_git/intel-extension-for-pytorch/docker$ test -z "$RENDER" || RENDER_GROUP="--group-add ${RENDER}"
(base) tedliosu@victus-ted:~/Documents/all_git/intel-extension-for-pytorch/docker$ sudo -H docker run --rm -v /home/tedliosu/intel_pytorch_workspace:/workspace --group-add ${VIDEO} ${RENDER_GROUP} --device=/dev/dri --ipc=host -it $IMAGE_NAME bash
[sudo] password for tedliosu: 
groups: cannot find name for group ID 109
root@8e852a62c8b4:/# cd workspace/
root@8e852a62c8b4:/workspace# ls
datasets  ipex_f32_example.py  testfile.txt
root@8e852a62c8b4:/workspace# python3 ipex_f32_example.py 
Traceback (most recent call last):
  File "/workspace/ipex_f32_example.py", line 2, in <module>
    import torchvision
ModuleNotFoundError: No module named 'torchvision'

Contents of “/workspace/ipex_f32_example.py” (as you can see it’s straight from one of the example scripts here):

import torch
import torchvision
############# code changes ###############
import intel_extension_for_pytorch as ipex
############# code changes ###############

LR = 0.001
DOWNLOAD = True
DATA = 'datasets/cifar10/'

transform = torchvision.transforms.Compose([
    torchvision.transforms.Resize((224, 224)),
    torchvision.transforms.ToTensor(),
    torchvision.transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
train_dataset = torchvision.datasets.CIFAR10(
        root=DATA,
        train=True,
        transform=transform,
        download=DOWNLOAD,
)
train_loader = torch.utils.data.DataLoader(
        dataset=train_dataset,
        batch_size=128
)

model = torchvision.models.resnet50()
criterion = torch.nn.CrossEntropyLoss()
optimizer = torch.optim.SGD(model.parameters(), lr = LR, momentum=0.9)
model.train()
#################################### code changes ################################
model = model.to("xpu")
model, optimizer = ipex.optimize(model, optimizer=optimizer, dtype=torch.float32)
#################################### code changes ################################

for batch_idx, (data, target) in enumerate(train_loader):
    ########## code changes ##########
    data = data.to("xpu")
    target = target.to("xpu")
    ########## code changes ##########
    optimizer.zero_grad()
    output = model(data)
    loss = criterion(output, target)
    loss.backward()
    optimizer.step()
    print(batch_idx)
torch.save({
     'model_state_dict': model.state_dict(),
     'optimizer_state_dict': optimizer.state_dict(),
     }, 'checkpoint.pth')

As you can see a compatible torchvision pip package is currently not in the https://developer.intel.com/ipex-whl-stable-xpu repository, and therefore I can’t run any training OR inference workloads using the XPU branch of ipex 😕

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
sanchitintelcommented, Oct 31, 2022

Hi @tedliosu, currently, Intel Extension for PyTorch for GPU is based on PyTorch 1.10. So, for now, the TorchVision version compatible with it is TorchVision 0.11.3.

However, things are in flux, and work is already underway to port Intel Extension for PyTorch for GPU to the latest PyTorch version.

Please install TorchVision 0.11.3 with a command such as this one -

pip install torchvision==0.11.3 --no-deps

Thanks!

1reaction
sanchitintelcommented, Oct 31, 2022

@tedliosu, we really value your feedback!

Here’s a caveat you might need to be aware about - the current generation of Intel Arc series GPUs doesn’t support Float64 computations, but some PyTorch ops use FP64 (eg. batchnorm during training). So, you might wanna use Float64 emulation for such cases (you’d encounter an error if an operator would be using float64, and you’d be able to figure out when to enable it). Float64 emulation, however, is slower, so you might want to enable it only for workloads that actually use Float64. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Torchvision main documentation - PyTorch
For Beta features, we are committing to seeing the feature through to the Stable classification. We are not, however, committing to backwards compatibility....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found