摘要: torch.nn.Embedding(num_embeddings: int, embedding_dim: int)是用来embed词成为word embedding的 num_embeddings (int): size of the dictionary of embeddingsembedd 阅读全文
posted @ 2021-02-09 09:35 乌蝇哥 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 本文讨论了huggingface 🤗 Transformers的简单使用。原网址:https://huggingface.co/transformers/quicktour.html使用transformer库需要两个部件:Tokenizer和model。使用.from_pretrained(na 阅读全文
posted @ 2021-02-06 17:02 乌蝇哥 阅读(2807) 评论(0) 推荐(1) 编辑
摘要: "我心想,你这样落魄的人也配考我" "记着吧,将来考举可能用得到。” 1.* 这种就是element-wise的 2.torch.mul 也是elemenet-wise的,同* 3.torch.mm 单纯的数学上的矩阵乘法,不支持广播。也不支持tensor相乘。 4.torch.bmm 专门用来算t 阅读全文
posted @ 2021-02-03 16:34 乌蝇哥 阅读(735) 评论(0) 推荐(0) 编辑
摘要: 总结: torch.function(x, dim) 1.if 不传: 依照默认参数决定 2.if dim >=0 and dim <= x.dim()-1: 0是沿最粗数据粒度的方向进行操作,x.dim()-1是按最细粒度的方向。 3.if dim <0: dim的最小取值(此按照不同functi 阅读全文
posted @ 2021-02-03 12:10 乌蝇哥 阅读(2682) 评论(0) 推荐(1) 编辑
摘要: import torch torch.cuda.get_device_name() #查看自己的显卡 阅读全文
posted @ 2021-01-31 16:05 乌蝇哥 阅读(242) 评论(0) 推荐(0) 编辑
摘要: pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple 将matplotlib替换为其他包名称亦可。几秒钟就可以下载完。 阅读全文
posted @ 2021-01-25 15:39 乌蝇哥 阅读(888) 评论(0) 推荐(0) 编辑
摘要: 参考: https://blog.csdn.net/qq_41664845/article/details/84245520#t5 https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2s 阅读全文
posted @ 2021-01-24 20:53 乌蝇哥 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 参考:https://medium.com/analytics-vidhya/simple-tutorial-to-install-use-gnu-parallel-79251120d618 Download Latest version of GNU Parallel $ wget http:// 阅读全文
posted @ 2021-01-06 16:27 乌蝇哥 阅读(2342) 评论(0) 推荐(0) 编辑
摘要: reference: https://www.linuxprobe.com/linux-ls-grep-wc.html https://blog.csdn.net/developerof/article/details/79566570 统计文件个数(不递归): ls -l | grep "^-" 阅读全文
posted @ 2021-01-05 15:31 乌蝇哥 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 参考 读取文件 f = open('stus.json',encoding='utf-8') content = f.read() #使用loads()方法需要先读文件 user_dic = json.loads(cotent) print(user_dic) 读入后是一个dict对象 loads( 阅读全文
posted @ 2021-01-02 22:08 乌蝇哥 阅读(91) 评论(1) 推荐(0) 编辑