File "/root/miniconda3/lib/python3.8/site-packages/yolox-0.3.0-py3.8-linux-x86_64.egg/yolox/models/attention.py", line 13, in __init__ self.mish = silu() # 可用自行选择激活函数 │ └ <function silu at 0x7f1babc58f70> └ CAM( (conv_1x1): Conv2d(512, 16, kernel_size=(1, 1), stride=(1, 1), bias=False) ) TypeError: silu() missing 1 required positional argument: 'input'
时间: 2023-06-24 10:05:30 浏览: 161
这个错误是因为 silu() 函数需要一个参数,但是在你的代码中没有传递参数。silu() 函数也称作 Swish 激活函数,可以用 torch.nn.functional.silu() 或者 torch.nn.SiLU() 的方式调用。你可以修改代码中这一行:
```python
self.mish = silu()
```
为:
```python
self.mish = torch.nn.SiLU()
```
或者:
```python
self.mish = torch.nn.functional.silu
```
这样就可以解决这个问题了。
相关问题
make /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/xproto.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/bigreq.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/xc_misc.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/composite.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/damage.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/dpms.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/dri2.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/glx.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/randr.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/record.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/render.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/res.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/screensaver.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/shape.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/shm.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/sync.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/xevie.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/xf86dri.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/xfixes.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/xinerama.xml /usr/bin/python ./c_client.py -p //usr/lib/python3.8/site-packages //usr/share/xcb/xinput.xml Traceback (most recent call last): File "./c_client.py", line 1039, in <module> module.register() File "/usr/lib/python2.7/dist-packages/xcbgen/state.py", line 93, in register matcher.execute(self, self.namespace) File "/usr/lib/python2.7/dist-packages/xcbgen/matcher.py", line 115, in execute funcs[elt.tag](elt, module, namespace) KeyError: 'eventstruct' make: *** [Makefile:1018: xinput.c] Error 1
这个错误是由于使用的是 Python 2.7 而不是 Python 3.x,导致在执行 c_client.py 脚本时出现了错误。您需要在命令行中使用正确的 Python 版本来运行该脚本。您可以尝试使用以下命令来运行该脚本:
```
python3 c_client.py -p /usr/lib/python3.8/site-packages /usr/share/xcb/xproto.xml
```
您需要将所有的命令都替换为类似的命令,以正确运行该脚本。
WARNING: Target directory /root/miniconda3/lib/python3.8/site-packages/MarkupSafe-2.1.2.dist-info already exists. Specify --upgrade to force replacement. WARNING: Target directory /root/miniconda3/lib/python3.8/site-packages/markupsafe already exists. Specify --upgrade to force replacement. WARNING: Target directory /root/miniconda3/lib/python3.8/site-packages/jinja2 already exists. Specify --upgrade to force replacement. WARNING: Target directory /root/miniconda3/lib/python3.8/site-packages/Jinja2-3.1.2.dist-info already exists. Specify --upgrade to force replacement. WARNING: Target directory /root/miniconda3/lib/python3.8/site-packages/pcv already exists. Specify --upgrade to force replacement. WARNING: Target directory /root/miniconda3/lib/python3.8/site-packages/pcv-0.0.2.dist-info already exists. Specify --upgrade to force replacement. WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
这个警告提示是因为你正在以root用户的身份使用pip安装Python库,这可能会导致权限问题和与系统包管理器的冲突行为。为了避免这些问题,建议你使用虚拟环境来安装Python库。
你可以按照以下步骤来创建一个虚拟环境并在其中安装Python库:
1. 安装virtualenv:
```
pip install virtualenv
```
2. 在你的项目目录中创建一个虚拟环境:
```
virtualenv env
```
3. 激活虚拟环境:
```
source env/bin/activate
```
4. 在激活的虚拟环境中使用pip安装Python库,例如:
```
pip install package_name
```
5. 当你完成了虚拟环境中的工作,可以使用以下命令退出虚拟环境:
```
deactivate
```
通过使用虚拟环境,你可以避免权限问题和与系统包管理器的冲突行为,同时也可以更好地管理Python库的依赖关系。
阅读全文