AttributeError: 'Conv2d' object has no attribute 'padding_mode'

#1

Error when trying to run ly google app locally

Can someone help me with this error when I run my web app ?

0 Likes

(Sebastien Derhy) #2

I have the same issue… Does anyone have an idea on how to solve it?

1 Like

(Nick Benz) #3

I have the same issue! Please help.
Running in docker locally.
Trained in Gradient.

ERROR: Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py", line 368, in run_asgi
result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.7/site-packages/starlette/applications.py", line 133, in __call__
await self.error_middleware(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 122, in __call__
raise exc from None
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 100, in __call__
await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/cors.py", line 84, in __call__
await self.simple_response(scope, receive, send, request_headers=headers)
  File "/usr/local/lib/python3.7/site-packages/starlette/middleware/cors.py", line 140, in simple_response
await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 73, in __call__
raise exc from None
  File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 62, in __call__
await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 585, in __call__
await route(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 207, in __call__
await self.app(scope, receive, send)
  File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 40, in app
response = await func(request)
  File "app/server.py", line 65, in analyze
prediction = learn.predict(img)[0]
  File "/usr/local/lib/python3.7/site-packages/fastai/basic_train.py", line 365, in predict
res = self.pred_batch(batch=batch)
  File "/usr/local/lib/python3.7/site-packages/fastai/basic_train.py", line 345, in pred_batch
preds = loss_batch(self.model.eval(), xb, yb, cb_handler=cb_handler)
  File "/usr/local/lib/python3.7/site-packages/fastai/basic_train.py", line 26, in loss_batch
out = model(*xb)
  File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward
input = module(input)
  File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward
input = module(input)
  File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 331, in forward
if self.padding_mode == 'circular':
  File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 539, in __getattr__
type(self).__name__, name))
AttributeError: 'Conv2d' object has no attribute 'padding_mode'
0 Likes

(Nick Benz) #4

I fixed it. Changed requirements.txt to this

aiofiles==0.4.0
aiohttp==3.5.4
asyncio==3.4.3
fastai==1.0.52
torch==1.0.0
torchvision==0.4.0
numpy==1.16.3
starlette==0.12.0
uvicorn==0.7.1
python-multipart==0.0.5

problem was here
torch==1.1.0 -> 1.0.0
torchvision==0.3.0 -> 0.4.0

0 Likes