Field cacheDepartments in com.yangpan.server.service.impl.DepartmentServiceImpl required a bean of type 'java.util.List' that could not be found.
时间: 2023-06-09 22:02:34 浏览: 64
这似乎是一个 Spring 框架的问题,可能是由于缺少相关的配置或者依赖引起的。您可以检查您的代码和配置文件,确保您已经正确地定义了 bean,并且依赖已经正确地添加到项目中。您还可以查看日志文件,看看是否有任何相关的错误提示,并尝试根据提示进行修改。如果您无法解决这个问题,可能需要与更有经验的开发人员进行沟通或寻求帮助。
相关问题
将.pth.tar文件转成onnx时出现错误AttributeError: 'dict' object has no attribute 'eval'
根据引用\[1\]中的信息,load_state_dict()方法返回的是_IncompatibleKeys对象,而不是模型本身。因此,在使用赋值等号时,model并不是你想要的那个模型,所以没有to、eval等属性。
根据引用\[2\]中的信息,将.pth模型转换为onnx的代码示例中,使用了torch.load()方法加载了.pth模型,并将其赋值给了model变量。然后使用torch.onnx.export()方法将模型导出为onnx格式。这种方式可以正确地将.pth模型转换为onnx格式。
根据引用\[3\]中的信息,如果你想加载保存的网络模型,可以直接使用torch.load()方法加载模型文件,并将其赋值给model变量。然后调用model.eval()方法将模型设置为评估模式。
综上所述,出现错误AttributeError: 'dict' object has no attribute 'eval'的原因是你使用了错误的方式加载模型。正确的方式是使用torch.load()方法加载模型文件,并调用model.eval()方法将模型设置为评估模式。
#### 引用[.reference_title]
- *1* [(完全解决)AttributeError: ‘_IncompatibleKeys‘ object has no attribute ‘to‘/‘eval](https://blog.csdn.net/qq_43391414/article/details/124074124)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [Pytorch模型转ONNX](https://blog.csdn.net/yangpan011/article/details/125848508)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [pytorch载入模型时出现错误AttributeError Generator object has no attribute copy](https://blog.csdn.net/LLLLUFFY/article/details/106561536)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
用正则表达式从字符串"王宇,15183257971,22040319510608229X,yangpan@dx.com"中提取姓名、电话、身份证号、邮箱,并存入字典中
好的,我可以帮你完成这个任务。以下是 Python 代码实现:
```python
import re
string = "王宇,15183257971,22040319510608229X,yangpan@dx.com"
pattern = r'^(.*?),(.*?),(.*?),(.*?)$'
result = re.match(pattern, string)
if result:
name = result.group(1)
phone = result.group(2)
id_card = result.group(3)
email = result.group(4)
info = {
"姓名": name,
"电话": phone,
"身份证号": id_card,
"邮箱": email
}
print(info)
else:
print("无法匹配")
```
输出结果为:
```
{'姓名': '王宇', '电话': '15183257971', '身份证号': '22040319510608229X', '邮箱': 'yangpan@dx.com'}
```
希望这个代码可以帮助到你!
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)