-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YoloV5 in Inf1 #330
Comments
The problem was solved whit this:
|
Hi! I was able to convert the model from yolov5 to neuron with the follow code:
Now that I am trying to test and compare I have the tensors outputs different from yolo as follow: Neuron Yolov5 Model:
Yolov5:
Inference script:
Is there something wrong when converting the model or running inference? The label and also the acc seems to be same as the expected, but tensors not. |
👋 @josebenitez Did you manage to solve your problem ? |
This is probably the latest reply! We were able to compile for yolov5 and yolov8 |
Hi, I'm trying to replicate the steps indicated in #253 to convert YoloV5s to neuron in inf1.
I am using Ubuntu 18.04 DLAMI. Activate the aws_neuron_pytorch_p36 python env
But this gives me the following error:
Fusing layers... Model Summary: 224 layers, 7266973 parameters, 0 gradients Adding AutoShape... /home/ubuntu/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py:60: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if self.grid[i].shape[2:4] != x[i].shape[2:4] or self.onnx_dynamic: /home/ubuntu/anaconda3/envs/aws_neuron_pytorch_p36/lib/python3.6/site-packages/torch/jit/_trace.py:940: TracerWarning: Encountering a list at the output of the tracer might cause the trace to be incorrect, this is only valid if the container structure does not change based on the module's inputs. Consider using a constant container instead (e.g. for list, use a tupleinstead. fordict, use a NamedTupleinstead). If you absolutely need this and know the side effects, pass strict=False to trace() to allow this behavior. _force_outplace, /home/ubuntu/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py:60: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if self.grid[i].shape[2:4] != x[i].shape[2:4] or self.onnx_dynamic: /home/ubuntu/anaconda3/envs/aws_neuron_pytorch_p36/lib/python3.6/site-packages/torch/jit/_trace.py:940: TracerWarning: Encountering a list at the output of the tracer might cause the trace to be incorrect, this is only valid if the container structure does not change based on the module's inputs. Consider using a constant container instead (e.g. forlist, use a tupleinstead. fordict, use a NamedTupleinstead). If you absolutely need this and know the side effects, pass strict=False to trace() to allow this behavior. _force_outplace, Traceback (most recent call last): File "neuron_converter.py", line 11, in model_neuron_for_inspection = torch.neuron.trace(model, fake_image, skip_compiler=True) File "/home/ubuntu/anaconda3/envs/aws_neuron_pytorch_p36/lib/python3.6/site-packages/torch_neuron/convert.py", line 103, in trace neuron_graph, jit_trace = to_graph(func, example_inputs, return_trace=True, **kwargs) File "/home/ubuntu/anaconda3/envs/aws_neuron_pytorch_p36/lib/python3.6/site-packages/torch_neuron/convert.py", line 182, in to_graph jit_trace = torch.jit.trace(func_or_mod, example_inputs, **kwargs) File "/home/ubuntu/anaconda3/envs/aws_neuron_pytorch_p36/lib/python3.6/site-packages/torch/jit/_trace.py", line 742, in trace _module_class, File "/home/ubuntu/anaconda3/envs/aws_neuron_pytorch_p36/lib/python3.6/site-packages/torch/jit/_trace.py", line 966, in trace_module _module_class, File "/home/ubuntu/anaconda3/envs/aws_neuron_pytorch_p36/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/home/ubuntu/anaconda3/envs/aws_neuron_pytorch_p36/lib/python3.6/site-packages/torch/jit/_trace.py", line 519, in _check_trace raise TracingCheckError(*diag_info) torch.jit._trace.TracingCheckError: Tracing failed sanity checks! ERROR: Graphs differed across invocations!
Could you please guide me through how to perform the conversion for deploying it on Inf1? @Ownmarc
Thanks,
The text was updated successfully, but these errors were encountered: