read_write.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:visual_turing_test-tutorial 作者: mateuszmalinowski 项目源码 文件源码
def pickle_model(
        path, 
        model, 
        word2index_x,
        word2index_y,
        index2word_x,
        index2word_y):
    import sys
    import cPickle as pickle
    modifier=10
    tmp = sys.getrecursionlimit()
    sys.setrecursionlimit(tmp*modifier)
    with open(path, 'wb') as f:
        p_dict = {'model':model,
                'word2index_x':word2index_x,
                'word2index_y':word2index_y,
                'index2word_x':index2word_x,
                'index2word_y':index2word_y}
        pickle.dump(p_dict, f, protocol=2)
    sys.setrecursionlimit(tmp)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号