create_copy_task.py 文件源码

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

项目:attention 作者: louishenrifranc 项目源码 文件源码
def create_copy_task_files(self, context_filename, answer_filename, vocab_size, num_examples, max_sequence_length):
        with open(context_filename, 'w') as file:
            for _ in trange(num_examples):
                num_tokens = np.random.randint(2, max_sequence_length, 1)
                tokens = np.random.randint(0, vocab_size, num_tokens)
                file.write(" ".join([str(x) for x in list(tokens)]) + "\n")

        shutil.copyfile(context_filename, answer_filename)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号