上一页 1 2 3 4 5 6 ··· 56 下一页

2022年12月17日

摘要: 前言 Pytorch 由Facebook人工智能研究院于2017年推出,具有强大的GPU加速张量计算功能,并且能够自动进行微分计算,从而可以使用基于梯度的方法对模型参数进行优化。 Transformers库建立在Pytorch框架之上(Tensorflow的版本功能并不完善),我们需要通过 Pyto 阅读全文
posted @ 2022-12-17 23:12 朴素贝叶斯 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 在编写代码的过程中,相信大家肯定遇到过这样的情况:代码能够编译通过,没有语法错误,但是运行结果却不对,反复检查了很多遍,依然不知道哪里出了问题。这个时候,就需要调试程序了。 所谓调试(Debug),就是让代码一步一步慢慢执行,跟踪程序的运行过程。在调试的过程中,我们可以监控程序的每一个细节,包括变量 阅读全文
posted @ 2022-12-17 21:47 朴素贝叶斯 阅读(139) 评论(0) 推荐(0) 编辑

2022年12月16日

摘要: 指针也是C语言中最为困难的一部分,在学习中除了要正确理解基本概念,还必须要多编程,上机调试。 计算机中所有的数据都必须放在内存中,不同类型的数据占用的字节数不一样,例如 int 占用4个字节,char 占用1个字节。为了正确地访问这些数据,必须为每个字节都编上号码,就像门牌号、身份证号一样,每个字节 阅读全文
posted @ 2022-12-16 12:58 朴素贝叶斯 阅读(145) 评论(0) 推荐(0) 编辑

2022年12月8日

摘要: # Example of target with class indices loss = nn.CrossEntropyLoss() input = torch.randn(3, 5, requires_grad=True) target = torch.empty(3, dtype=torch. 阅读全文
posted @ 2022-12-08 22:51 朴素贝叶斯 阅读(27) 评论(0) 推荐(0) 编辑
摘要: x = torch.randn(4, 4) print("x size:",x.size()) y = x.view(16) print("y size:",y.size()) z = x.view(-1, 8) # the size -1 is inferred from other dimens 阅读全文
posted @ 2022-12-08 22:29 朴素贝叶斯 阅读(63) 评论(0) 推荐(0) 编辑
摘要: tensor = torch.randn(2, 2) # Initially dtype=float32, device=cpu tensor.to(torch.float64) cuda0 = torch.device('cuda:0') tensor.to(cuda0) tensor.to(cu 阅读全文
posted @ 2022-12-08 19:23 朴素贝叶斯 阅读(124) 评论(0) 推荐(0) 编辑

2022年12月6日

摘要: https://github.com/PaddlePaddle/PaddleNLP/blob/develop/paddlenlp/data/collate.py 阅读全文
posted @ 2022-12-06 00:07 朴素贝叶斯 阅读(94) 评论(0) 推荐(0) 编辑

2022年12月4日

摘要: @dataclass class DataCollatorWithPadding: """ Data collator that will dynamically pad the inputs to the longest sequence in the batch. Args: tokenizer 阅读全文
posted @ 2022-12-04 21:13 朴素贝叶斯 阅读(152) 评论(0) 推荐(0) 编辑
摘要: DataCollatorMixin类 class DataCollatorMixin: def __call__(self, features, return_tensors=None): if return_tensors is None: return_tensors = self.return 阅读全文
posted @ 2022-12-04 14:32 朴素贝叶斯 阅读(165) 评论(0) 推荐(0) 编辑

2022年11月26日

摘要: 本章将介绍 5 种迭代器适配器,分别是: 反向迭代器适配器、 插入型迭代器适配器、 流迭代器适配器、 流缓冲区迭代器适配器、 移动迭代器适配器。 初学者完全可以将迭代器适配器视为普通迭代器。之所以称为迭代器适配器,是因为这些迭代器是在输入迭代器、输出迭代器、前向迭代器、双向迭代器或者随机访问迭代器这 阅读全文
posted @ 2022-11-26 09:19 朴素贝叶斯 阅读(18) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 56 下一页

导航