from models.NLP.roberta.models.roberta import Roberta
flow_model = Roberta(**kwargs)
flow_model.load_state_dict(torch_para, False)
flow.save(flow_model.state_dict(), "/root/autodl-tmp/oneflow_trans/oneflow/chemberta")
报错:
Traceback (most recent call last):
File "chemberta.py", line 35, in
flow.save(flow_model.state_dict(), "/code/oneflow/oneflow_chemberta")
File "/opt/conda/lib/python3.8/site-packages/oneflow/framework/check_point_v2.py", line 737, in save
write_file()
File "/opt/conda/lib/python3.8/site-packages/oneflow/framework/check_point_v2.py", line 723, in write_file
with _open_file_like(path_or_buffer, "wb") as f:
File "/opt/conda/lib/python3.8/site-packages/oneflow/framework/check_point_v2.py", line 99, in _open_file_like
return _open_file(path_or_buffer, mode)
File "/opt/conda/lib/python3.8/site-packages/oneflow/framework/check_point_v2.py", line 80, in init
super(_open_file, self).init(open(path, mode))
IsADirectoryError: [Errno 21] Is a directory: '/code/oneflow/oneflow_chemberta'
System Information
What is your OneFlow installation (pip, source, dockerhub): dockerhub
OS: Ubuntu 18.04.6 LTS
OneFlow version (run python3 -m oneflow --doctor): 0.9.1.dev20230630+cu117
Summary
使用0.9.1.dev20230630+cu117版本的oneflow在保存由torch转换的模型时在最后报错。使用0.9.0版本不会报错,能成功保存模型
Code to reproduce bug
from models.NLP.roberta.models.roberta import Roberta flow_model = Roberta(**kwargs) flow_model.load_state_dict(torch_para, False) flow.save(flow_model.state_dict(), "/root/autodl-tmp/oneflow_trans/oneflow/chemberta")
报错: Traceback (most recent call last): File "chemberta.py", line 35, in flow.save(flow_model.state_dict(), "/code/oneflow/oneflow_chemberta") File "/opt/conda/lib/python3.8/site-packages/oneflow/framework/check_point_v2.py", line 737, in save write_file() File "/opt/conda/lib/python3.8/site-packages/oneflow/framework/check_point_v2.py", line 723, in write_file with _open_file_like(path_or_buffer, "wb") as f: File "/opt/conda/lib/python3.8/site-packages/oneflow/framework/check_point_v2.py", line 99, in _open_file_like return _open_file(path_or_buffer, mode) File "/opt/conda/lib/python3.8/site-packages/oneflow/framework/check_point_v2.py", line 80, in init super(_open_file, self).init(open(path, mode)) IsADirectoryError: [Errno 21] Is a directory: '/code/oneflow/oneflow_chemberta'
System Information
python3 -m oneflow --doctor
): 0.9.1.dev20230630+cu117