Hierarchical-attention-networks-pytorch
                                
                                
                                
                                    Hierarchical-attention-networks-pytorch copied to clipboard
                            
                            
                            
                        No works on GPU
Try to run the code on GPU. But it seems still on CPU.
me too
I trained on GPU. Let check your gpu configuration. My code will automatically detect if gpu is available and if yes, the model will be trained on gpu
Doesn't run on GPU for me as well, only CPU. I tried both ways, calling .cuda() and .to('cuda') on the model and the tensors, no success.
The model and the tensors return is_cuda=True, still the GPU load is close to 0% and CPU load is 100%.
I found the reason why GPU load is so low that the dataloader processes data so slowly and GPU is always waiting.
I found the reason why GPU load is so low that the dataloader processes data so slowly and GPU is always waiting.
can you share your found ? I've been troubled by this problem too, the model and the tensors return is_cuda=True, still the GPU load is 0%.
I found the reason why GPU load is so low that the dataloader processes data so slowly and GPU is always waiting.
can you share your found ? I've been troubled by this problem too, the model and the tensors return is_cuda=True, still the GPU load is 0%.
i have set num_workers=8 and pin_memory=true in dataloader, but it doesn't work ,still the GPU load is 0%
you can try this: rewrite the getitem function in dataset.py and just for getting items, not process data, and move the process operation to preprocess functions such as word segmentation, word encoding and so on. I recommend that you can use the parameter 'collate_fn' in Dataloader and do some necessary operations like padding. My code put on below for reference. class MyData(data.Dataset): def init(self, root, state='train'): self.root = root with open(root, 'rb') as f: [self.train_x, self.train_y, self.val_x, self.val_y, self.test_x, self.test_y, self.word2index, self.label2index, self.n_words, self.n_labels,
self.train_sq_len, self.test_sq_len
] = pickle.load(f) if state is 'train': self.feature = self.train_x[:] self.label = self.train_y[:] elif state is 'test': self.feature = self.test_x self.label = self.test_y else: self.feature = self.val_x self.label = self.val_y
def getitem(self, item): feature = self.feature[item] label = self.label[item] return feature, label
def len(self): return len(self.feature)
def collate_func(batch): feature = [] label = [] n_labels = 33 for i, j in batch: feature.append(i) label.append(j) feature, sentence_sq = DataProcess.pad_sentence(feature) feature, uttr_sq, sentence_sq = DataProcess.pad_utterance(feature, sentence_sq) label = DataProcess.change_label_shape(label, n_labels)
return bt 在 2020年4月9日 +0800 AM9:25,cynthia [email protected],写道:
I found the reason why GPU load is so low that the dataloader processes data so slowly and GPU is always waiting. can you share your found ? I've been troubled by this problem too, the model and the tensors return is_cuda=True, still the GPU load is 0%. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
@kenny1109 thanks, it's very nice of you
@kenny1109 did you slove that problem,i met the same problem