2

我试图让它在 google colab https://github.com/oawiles/X2Face/blob/master/UnwrapMosaic/Face2Face_UnwrapMosaic.ipynb中运行,

我能够让它运行并显示一次结果,但从那以后,我在使用此单元的所有可用 RAM 后,最近我的会话崩溃了

    BASE_MODEL = '/scratch/shared/slow/ow/eccv/2018/release_models/' # Change to your path
state_dict = torch.load(BASE_MODEL + 'x2face_model.pth')

model = UnwrappedFaceWeightedAverage(output_num_channels=2, input_num_channels=3, inner_nc=128)
model.load_state_dict(state_dict['state_dict'])
model = model.cuda()

model = model.eval()

我不确定这是否是 colab 问题

这是日志

warn("IPython.utils.traitlets has moved to a top-level traitlets package.")
/usr/local/lib/python2.7/dist-packages/IPython/utils/traitlets.py:5: UserWarning: IPython.utils.traitlets has moved to a top-level traitlets package.
4

2 回答 2

1

尝试更改设置,

转到运行时->更改运行时类型->硬件加速器->选择选项GPU或TPU

我认为这可能会有所帮助。

于 2020-01-24T06:15:45.573 回答
0

我的经验是切换到CPU colab版本,运行代码

然后切换到GPU colab版本

这些操作后代码运行顺利。

于 2020-04-14T03:55:15.393 回答