_Focus_
ACL/NAACL/EMNLP/COLING审稿人,
金庸群侠传MOD大侠梦/曹操传MOD禾下霸业作者
展开
-
调用detr-resnet-50进行目标检测
【代码】调用detr-resnet-50进行目标检测。原创 2024-10-29 14:33:21 · 175 阅读 · 0 评论 -
huggingface transformers 网络问题
建议还是找一个网络好的机器,跑通CPU版本,不建议自己去找到所需文件下载的本地。里有相关下载好的文件,原创 2024-10-28 10:53:42 · 31 阅读 · 0 评论 -
报错,operator torchvision::nms does not exist
torch和torchvision都要安装gpu版本,或者两个都是cpu版本,原创 2024-10-25 09:57:10 · 613 阅读 · 0 评论 -
安装指定cuda版本的torch和torchvision
建议去下面链接下载后本地安装。原创 2024-10-25 09:47:12 · 223 阅读 · 0 评论 -
huggingface transformers 报错 ‘list‘ object has no attribute ‘size‘
已经是python list类型,原创 2024-09-06 16:21:57 · 107 阅读 · 0 评论 -
使用 torch.utils.data 的 DataLoader
【代码】使用 torch.utils.data 的 DataLoader。原创 2024-09-05 23:16:43 · 93 阅读 · 0 评论 -
PyTorch 使用多GPU(数据并行)
【代码】PyTorch 使用多GPU。原创 2024-09-03 10:12:23 · 139 阅读 · 0 评论 -
PyTorch改为默认使用GPU
PyTorch默认用CPU,改默认用GPU,原创 2024-09-01 19:51:05 · 492 阅读 · 0 评论 -
安装cuda11.8版本的torch
在这里可以下载cuda11.8版本的不同版本的torch都有。原创 2024-06-22 22:10:15 · 1217 阅读 · 0 评论 -
安装torch时指定cuda版本
举例:conda install pytorch0.18.0 torchaudio==2.3.0 pytorch-cuda=11.8 -c pytorch -c nvidiaconda install pytorch0.18.0 torchaudio==2.3.0 pytorch-cuda=12.1 -c pytorch -c nvidiaconda install pytorch0.18.0 torchaudio==2.3.0 cpuonly -c pytorch。原创 2024-06-21 10:43:52 · 2070 阅读 · 0 评论 -
python和命令行查看cuda版本
命令行,有哪些cuda。原创 2024-06-18 10:19:06 · 667 阅读 · 1 评论 -
pytorch 检查GPU可用
【代码】pytorch 检查GPU可用。原创 2023-11-28 11:07:43 · 205 阅读 · 0 评论 -
huggingface/transformers 用Trainer 和 不用Trainer
【代码】huggingface/transformers 用Trainer 和 不用Trainer。原创 2023-10-19 15:53:07 · 216 阅读 · 0 评论 -
huggingface/transformers 确保模型利用GPU
【代码】huggingface/transformers 确保模型利用GPU。原创 2023-09-05 16:49:58 · 1145 阅读 · 0 评论 -
huggingface/transformers 预训练自己的数据
huggingface/transformers 会自动加载 能对应上的 参数。原创 2023-08-31 17:12:06 · 249 阅读 · 0 评论 -
AutoModelForSequenceClassification 得到embedding
【代码】AutoModelForSequenceClassification 得到embedding。原创 2023-08-25 20:45:16 · 235 阅读 · 0 评论 -
不预训练的话,用huggingface/transformers比google-research/bert的效果好2-4%
用于文本分类,正确率高2-4%原创 2023-08-01 11:00:44 · 148 阅读 · 0 评论 -
报错:Module ‘XXX‘ doesn‘t exist on the Hugging Face Hub
【代码】报错:Module ‘accuracy‘ doesn‘t exist on the Hugging Face Hub。原创 2023-08-01 10:04:40 · 3287 阅读 · 6 评论 -
huggingface/transformers tokenizer报错 list index out of range
【代码】huggingface/transformers tokenizer报错 list index out of range。原创 2023-06-28 10:18:07 · 610 阅读 · 0 评论 -
huggingface/transformers TFAutoModelForSeq2SeqLM 输出 embedding
【代码】huggingface/transformers TFAutoModelForSeq2SeqLM 输出 embedding。原创 2023-06-27 14:51:44 · 362 阅读 · 0 评论 -
LOMO: LOw-Memory Optimization 阅读笔记
文章贡献:减少对GPU内存的占用,从而能让GPU容纳更大的模型参数。原创 2023-06-26 10:46:08 · 158 阅读 · 0 评论 -
ImportError: cannot import name ‘skip_init‘ from ‘torch.nn.utils‘
torch==1.10.0 版本可以。问题所在:pytorch版本不对,原创 2023-06-19 12:00:04 · 1969 阅读 · 0 评论 -
symbol cudaGraphInstantiateWithFlags, version libcudart.so.11.0 not defined
问题所在:pytorch和cuda版本不匹配。原创 2023-06-19 11:47:27 · 1473 阅读 · 3 评论 -
deepspeed ZeRO-Inference 可在1-GPU上推理~100B的大模型
https://www.deepspeed.ai/2022/09/09/zero-inference.html原理:原创 2023-06-18 10:22:23 · 399 阅读 · 0 评论 -
huggingface/transformers,tokenizer出的attention_mask的坑
则tokenizer返回的。则tokenizer返回的。原创 2023-06-15 11:53:35 · 855 阅读 · 0 评论 -
TypeError: TextEncodeInput must be Union[TextInputSequence, Tuple[InputSequence, InputSequence]]
huggingface/transformers 的 tokenizer 报的错,报错原因,数据里有None值。原创 2023-06-15 09:06:21 · 726 阅读 · 0 评论 -
把huggingface/transformers的模型文件下载到本地
python代码 自动下载模型实现和参数。如果你的网络环境较差,下载模型参数可能会花费较长时间甚至失败。此时可以先将模型下载到本地,然后从本地加载。参考 https://github.com/THUDM/ChatGLM-6B 的README。以chatglm-6b为例,然后运行。先安装Git LFS。原创 2023-06-14 15:52:09 · 3339 阅读 · 0 评论 -
contrastive loss 的高级代码实现 (pytorch)
LARGE_NUM = 1e9 def _contrastive_loss_forward(self, hidden1: torch.Tensor, hidden2: torch.Tensor, hidden_norm: bool = True, ...原创 2021-08-17 10:55:46 · 4598 阅读 · 0 评论 -
把 kmeans聚类 融入深度模型 --> KmeansAttention
https://github.com/lucidrains/routing-transformer/blob/master/routing_transformer/routing_transformer.py原创 2021-08-09 10:43:49 · 495 阅读 · 0 评论 -
pytorch add_
# a = a + 4 * 5import torcha = torch.tensor([1,2,3])a.data.add_(torch.tensor(4),torch.tensor(5))print(a) # tensor([21, 22, 23])原创 2020-09-22 20:40:05 · 1305 阅读 · 0 评论 -
pytorch addcdiv 和 addcdiv_
# a = a + 4 / 2import torcha = torch.tensor([1,2,3])a.addcdiv(torch.tensor(4),torch.tensor(2))print(a) # tensor([1, 2, 3]) # 值不加a.data.addcdiv_(torch.tensor(4),torch.tensor(2))print(a) # tensor([3, 4, 5]) # 值加a = a.addcdiv(torch.tensor(4),torch.t原创 2020-09-22 20:37:27 · 1066 阅读 · 0 评论 -
sh run安装cuda失败,Finished with code: 256
要先禁用nouveau保证lsmod |grep nouveau不显示信息原创 2020-06-20 21:01:27 · 18413 阅读 · 3 评论 -
pytorch pad 实例
import torchtensor = torch.Tensor([[[1,1],[2,2],[3,3]],[[4,4],[5,5],[6,6]]])print(tensor.shape)print(tensor)pad_tensor = torch.constant_pad_nd(tensor,(0,0,0,2))print(pad_tensor.shape)print(pad_tensor)print结果:torch.Size([2, 3, 2])tensor([[[1., 1.]原创 2020-05-09 19:30:15 · 941 阅读 · 0 评论 -
multi-label分类,loss一直增大
label为[batch_size, num_class]logits为[batch_size, num_class]每个label为比如[0,0,1,0,0,0,1,0,1,0],就是10类有3类正确不能用tf.nn.softmax_cross_entropy_with_logitsPytorch使用torch.nn.BCElossTensorflow使用tf.losses.sigmo...原创 2020-02-25 20:13:35 · 832 阅读 · 0 评论 -
一个pytorch的pointer net实现
https://github.com/pcyin/tranX/blob/master/model/pointer_net.py原创 2019-12-16 11:20:29 · 716 阅读 · 0 评论 -
一个带copy机制的seq2seq的pytorch实现
https://github.com/pcyin/tranX/blob/master/model/seq2seq_copy.py原创 2019-12-16 11:19:38 · 904 阅读 · 0 评论 -
一种输入[batch, seq_len1, hidden_dim]输出[batch, seq_len2, hidden_dim]的self-attention的pytorch实现
class Attention(nn.Module): """ inputs是[batch, seq_len1, hidden_dim] labels_num是seq_len2 """ def __init__(self, labels_num, hidden_size): super(Attention, self).__init__()...原创 2019-12-16 11:17:23 · 763 阅读 · 0 评论 -
pytorch 三维one-hot tensor的制作
import torchbatch_size = 2sequence_len = 3hidden_dim = 5x = torch.zeros(batch_size, sequence_len, hidden_dim).scatter_(dim=-1, index=torch.LongTensor([[[2],[2],[1]]...原创 2019-10-14 09:24:30 · 1542 阅读 · 0 评论 -
pytorch 报错 RuntimeError: Invalid index in scatter at
很大可能是因为index的值超出了范围,比如import torchbatch_size = 2hidden_dim = 5x = torch.zeros(batch_size, hidden_dim).scatter_(dim=-1, index=torch.LongTensor([[2],[1]]), ...原创 2019-10-14 09:20:39 · 2707 阅读 · 0 评论 -
sqlova 代码走读
输入BERT的方式 https://github.com/naver/sqlova/blob/master/sqlova/utils/utils_wikisql.py在generate_inputs方法[CLS] question_word_1,question_word_2,...question_word_n [SEP] header_1 [SEP] header_2 [SEP] ... ...原创 2019-09-10 11:06:55 · 660 阅读 · 0 评论
分享