pytorch-arm-builds icon indicating copy to clipboard operation
pytorch-arm-builds copied to clipboard

Updates on newer pytorch versions for armv6 and arm v7?

Open bhaktatejas922 opened this issue 4 years ago • 5 comments

Hey, wanted to see if it was possible to get newer wheels for the new versions of torch and torchvision? I can provide a wheel for armv6 pytorch 1.7

This kind of stuff is needed for newer performant models like yolov5 from ultralytics

bhaktatejas922 avatar Oct 04 '20 05:10 bhaktatejas922

Following the instructions described in this repository and the blog (https://nmilosev.svbtle.com/compling-arm-stuff-without-an-arm-board-build-pytorch-for-the-raspberry-pi), I tried to compile the wheels for pytorch and torchvision from their master branches.

I get the following results on an old Raspberry Pi board:

pi@raspberrypi:~ $ python3 inference.py tiger.jpg
        Error in cpuinfo: failed to parse file /sys/devices/system/cpu/kernel_max: "-1
" is not an unsigned number
[W NNPACK.cpp:80] Could not initialize NNPACK! Reason: Unsupported hardware.
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
9.223510026931763
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.123948812484741
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.06088399887085
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.056798934936523
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.088870286941528
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.072832584381104
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.086567401885986
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.06592345237732
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.076662302017212
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.075530290603638

It seems the average running speed (~8s) for the example is much lower than that reported in the repository (~4s). The system and hardware information are as follows:

pi@raspberrypi:~ $ lsb_release -a
No LSB modules are available.
Distributor ID:  Raspbian
Description:     Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

pi@raspberrypi:~ $ cat /proc/cpuinfo
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 000d
Serial          : 0000000069ae4dbd
Model           : Raspberry Pi Model B Rev 2

As the wheels were built with an armv7l system, so I renamed them with armv6l postfixes, e.g., from torchvision-0.9.0a0+d3d3936-cp37-cp37m-linux_armv7l.whl to torchvision-0.9.0a0+d3d3936-cp37-cp37m-linux_armv6l.whl. Then the wheels can be installed in the armv6l board. I didn't test the in armv7l board as I din't have that board.

The wheels can be downloaded in https://icedrive.net/1/76FFGZiyDO.

torch-1.8.0a0-cp37-cp37m-linux_armv7l.whl
torchvision-0.9.0a0+d3d3936-cp37-cp37m-linux_armv7l.whl

zhongzisha avatar Dec 06 '20 08:12 zhongzisha

Hi, Do you, by any chance, have the wheel files for torch>1.5 and torchvision>0.6 for aarch64 instead of armv7l, by any chance?

AbhishekPokala avatar Dec 18 '20 17:12 AbhishekPokala

Hi, @AbhishekPokala , could you please try to use the wheels in https://icedrive.net/1/76FFGZiyDO in your aarch64 platform? The wheels were built for Jetson TX2, but it is expected that they can be run in rasperberry pi system. I don't have the arm64-based rasperberry pi board so I can not test that.

zhongzisha avatar Dec 25 '20 03:12 zhongzisha

Following the instructions described in this repository and the blog (https://nmilosev.svbtle.com/compling-arm-stuff-without-an-arm-board-build-pytorch-for-the-raspberry-pi), I tried to compile the wheels for pytorch and torchvision from their master branches.

I get the following results on an old Raspberry Pi board:

pi@raspberrypi:~ $ python3 inference.py tiger.jpg
        Error in cpuinfo: failed to parse file /sys/devices/system/cpu/kernel_max: "-1
" is not an unsigned number
[W NNPACK.cpp:80] Could not initialize NNPACK! Reason: Unsupported hardware.
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
9.223510026931763
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.123948812484741
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.06088399887085
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.056798934936523
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.088870286941528
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.072832584381104
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.086567401885986
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.06592345237732
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.076662302017212
[('tiger, Panthera tigris', 91.03486633300781),
('tiger cat', 8.8656644821167),
('tabby, tabby cat', 0.017998842522501945),
('lynx, catamount', 0.00972796231508255),
('cougar, puma, catamount, mountain lion, painter, panther, Felis concolor',
0.00484913494437933)]
8.075530290603638

It seems the average running speed (~8s) for the example is much lower than that reported in the repository (~4s). The system and hardware information are as follows:

pi@raspberrypi:~ $ lsb_release -a
No LSB modules are available.
Distributor ID:  Raspbian
Description:     Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

pi@raspberrypi:~ $ cat /proc/cpuinfo
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 000d
Serial          : 0000000069ae4dbd
Model           : Raspberry Pi Model B Rev 2

As the wheels were built with an armv7l system, so I renamed them with armv6l postfixes, e.g., from torchvision-0.9.0a0+d3d3936-cp37-cp37m-linux_armv7l.whl to torchvision-0.9.0a0+d3d3936-cp37-cp37m-linux_armv6l.whl. Then the wheels can be installed in the armv6l board. I didn't test the in armv7l board as I din't have that board.

The wheels can be downloaded in https://icedrive.net/1/76FFGZiyDO.

torch-1.8.0a0-cp37-cp37m-linux_armv7l.whl
torchvision-0.9.0a0+d3d3936-cp37-cp37m-linux_armv7l.whl

dude these work like a charm, tried them on a Raspbery pi B 2, installed them and they just worked, consider creating a repository, this one seems to be not maintained anymore

Rumidom avatar Jun 25 '21 03:06 Rumidom

Hello there. Do any of you still have possession of the wheel files (armv7l and armv6l) for the torch (1.8) and torchvision(0.9) posted by zhongzisha? The files that he/she posted on his icedrive link doesn't seem to be there anymore.

Also by any chance, do any of you have the wheel files for the newer pytorch versions like 1.10 or 1.11?

Thanks in advance!

Clif123 avatar May 18 '22 19:05 Clif123