TypeError: new(): data must be a sequence (got NoneType)

username: sixthgalaxy
cooked: <p><strong>Can you please explain to me the following <strong>Type Error</strong>. I am getting this error when I try to upload the test image via a  webpage. But it works fine when I CURL  it</strong></p>
<p>2021-03-31 21:54:09,364 [INFO ] W-9000-densenet161_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -     image = torch.FloatTensor(image)</p>
<p>**21-03-31 21:54:09,364 [INFO ] W-9000-densenet161_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle - <strong>TypeError: new(): data must be a sequence (got NoneType)</strong></p>

username: ptrblck
cooked: <p>Based on the error message <code>image</code> is not loaded properly and is a <code>None</code> as seen here:</p>
<pre><code class="lang-python">torch.FloatTensor(None)
&gt; TypeError: new(): data must be a sequence (got NoneType)
</code></pre>
<p>so I assume the upload or data loading fails.</p>

username: sixthgalaxy
cooked: <p><a class="mention" href="/u/ptrblck">@ptrblck</a> thank you so much for having a look. Please see below the logs. Can you please let me know what  can be the possible reason for <strong>" Invoking custom service failed"</strong></p>
<p>2021-04-01 12:40:27,029 [INFO ] W-9001-densenet161_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle - Invoking custom service failed.<br>
2021-04-01 12:40:27,030 [INFO ] W-9001-densenet161_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle - Traceback (most recent call last):<br>
2021-04-01 12:40:27,031 [INFO ] W-9001-densenet161_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -   File “/home/venv/lib/python3.6/site-packages/ts/service.py”, line 100, in predict<br>
2021-04-01 12:40:27,032 [INFO ] W-9001-densenet161_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -     ret = self._entry_point(input_batch, self.context)<br>
2021-04-01 12:40:27,032 [INFO ] W-9001-densenet161_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -   File “/home/venv/lib/python3.6/site-packages/ts/torch_handler/base_handler.py”, line 194, in handle<br>
2021-04-01 12:40:27,033 [INFO ] W-9001-densenet161_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -     data_preprocess = self.preprocess(data)<br>
2021-04-01 12:40:27,034 [INFO ] W-9001-densenet161_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -   File “/home/venv/lib/python3.6/site-packages/ts/torch_handler/vision_handler.py”, line 49, in preprocess<br>
2021-04-01 12:40:27,039 [INFO ] W-9001-densenet161_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle -     image = torch.FloatTensor(image)<br>
2021-04-01 12:40:27,040 [INFO ] W-9001-densenet161_1.0-stdout org.pytorch.serve.wlm.WorkerLifeCycle - TypeError: new(): data must be a sequence (got NoneType)<br>
2021-04-01 12:40:27,032 [INFO ] W-9001-densenet161_1.0 org.pytorch.serve.wlm.WorkerThread - Backend response time: 2<br>
2021-04-01 12:40:27,041 [INFO ] W-9001-densenet161_1.0 ACCESS_LOG - /192.168.8.115:35886 “POST /predictions/densenet161 HTTP/1.1” 503 123<br>
2021-04-01 12:40:27,041 [INFO ] W-9001-densenet161_1.0 TS_METRICS - Requests5XX.Count:1|#Level:Host|#hostname:6b80040fb46b,timestamp:null<br>
2021-04-01 12:40:27,050 [DEBUG] W-9001-densenet161_1.0 org.pytorch.serve.job.Job - Waiting time ns: 101351455, Inference time ns: 124289758<br>
2021-04-01 12:40:27,051 [INFO ] W-9001-densenet161_1.0 TS_METRICS - WorkerThreadTime.ms:22|#Level:Host|#hostname:6b80040fb46b,timestamp:null</p>

username: ptrblck
cooked: <p>This error message is most likely raised by the <code>new()</code> error, as it’s also pointing to it in the stack trace a bit later.</p>

username: sixthgalaxy
cooked: <p>thank you so much  <a class="mention" href="/u/ptrblck">@ptrblck</a></p>