You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/10/11 06:32:40 UTC
[GitHub] [tvm] LightricksNatanKaminsky opened a new issue #9241: [Bug] Torch and torchvision break auto scheduling with RPC on android
LightricksNatanKaminsky opened a new issue #9241:
URL: https://github.com/apache/tvm/issues/9241
### Expected behavior
When I import torch or torchvision and try to auto schedule (even models that are not from pytorch) the program exits after one trial of fine tuning.
### Environment
I’m using torch version 1.7.0 and torchvision version 0.8.1. I ran this script on mac with macOS Big Sur 11.6, and my android device is Samsung S21 5G.
### Steps to reproduce
The following script reproduces this issue:
```
import torch
import torchvision
import os
import tvm
from tvm import relay, auto_scheduler, rpc
import tvm.relay.testing
import numpy as np
if __name__ == "__main__":
mod, params = relay.testing.mobilenet.get_workload(
batch_size=1, layout="NHWC", dtype="float32", image_shape=(224, 224, 3)
)
tracker_host = "0.0.0.0"
tracker_port = 9000
key = 'android'
os.environ["TVM_NDK_CC"] = '/users/nkaminsky/library/android/android-toolchain-arm64/bin/aarch64-linux-android-g++'
builder = tvm.auto_scheduler.LocalBuilder(build_func='ndk')
runner = tvm.auto_scheduler.RPCRunner(key=key, host=tracker_host, port=tracker_port, priority=0, number=3, repeat=1)
tasks, task_weights = tvm.auto_scheduler.extract_tasks(
mod['main'], params, tvm.target.Target("llvm -device=arm_cpu", "llvm -mtriple=arm64-linux-android")
)
tuner = tvm.auto_scheduler.TaskScheduler(tasks, task_weights)
output_file = './auto_scheduled_model.json'
tune_options = tvm.auto_scheduler.TuningOptions(num_measure_trials=50,
builder=builder,
runner=runner,
measure_callbacks=[tvm.auto_scheduler.RecordToFile(output_file)])
tuner.tune(tune_options)
```
The error I get is:
```
Get devices for measurement successfully!
----------------------------------------------------------------------
------------------------------ [ Task Scheduler ]
----------------------------------------------------------------------
| ID | Latency (ms) | Speed (GFLOPS) | Trials |
-------------------------------------------------
| 0 | - | - | 0 |
| 1 | - | - | 0 |
| 2 | - | - | 0 |
| 3 | - | - | 0 |
| 4 | - | - | 0 |
| 5 | - | - | 0 |
| 6 | - | - | 0 |
| 7 | - | - | 0 |
| 8 | - | - | 0 |
| 9 | - | - | 0 |
| 10 | - | - | 0 |
| 11 | - | - | 0 |
| 12 | - | - | 0 |
| 13 | - | - | 0 |
| 14 | - | - | 0 |
| 15 | - | - | 0 |
| 16 | - | - | 0 |
| 17 | - | - | 0 |
| 18 | - | - | 0 |
| 19 | - | - | 0 |
| 20 | - | - | 0 |
| 21 | - | - | 0 |
-------------------------------------------------
Estimated total latency: - ms Trials: 0 Used time : 1 s Next ID: 0
----------------------------------------------------------------------
------------------------------ [ Search ]
----------------------------------------------------------------------
Generate Sketches #s: 3
Sample Initial Population #s: 1513 fail_ct: 0 Time elapsed: 4.04
GA Iter: 0 Max score: 0.9999 Min score: 0.9974 #Pop: 4 #M+: 0 #M-: 0
GA Iter: 4 Max score: 1.0000 Min score: 0.9997 #Pop: 4 #M+: 1390 #M-: 28
EvolutionarySearch #s: 4 Time elapsed: 17.45
----------------------------------------------------------------------
------------------------------ [ Measure ]
----------------------------------------------------------------------
Get 2 programs to measure:
..**
Time elapsed for measurement: 8.15 s
----------------------------------------------------------------------
------------------------------ [ Train cost model ]
----------------------------------------------------------------------
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
```
When I comment out import torch and import torchvision the script runs properly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org