【发布时间】:2021-12-30 10:28:10
【问题描述】:
我开发了一个使用 Pytorch 执行神经网络建模的代码。我的代码在我的 Pycharm 控制台中运行良好,但是当我从脚本运行它时它不起作用。我检查了几次,没有发现任何明显的问题。
我得到的完整错误是:
运行时错误: 已尝试在 当前进程已完成其引导阶段。
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
我的代码中的错误似乎源于我的培训师(更具体地说,在最后一行,即“val_split=0.1)”:
trainer.fit(
X_tab=X_tab,
target=target,
n_epochs=5,
batch_size=256,
val_split=0.1)
我使用 Python 3.7 和 Windows,如果有帮助的话。这可能是多处理问题还是其他问题?
【问题讨论】: