Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
920232796 committed Nov 22, 2021
1 parent 4319ee7 commit 5e32826
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/bart_auto_title_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ def padding(indice, max_length, pad_idx=0):
class Trainer:
def __init__(self):
# 加载数据
self.sents_src, self.sents_tgt = read_file(src_dir, tgt_dir)
self.sents_src, self.sents_tgt = read_file()

# 判断是否有可用GPU
self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
self.device = torch.device("cuda:1" if torch.cuda.is_available() else "cpu")
print("device: " + str(self.device))
# 定义模型
self.model = ExtendModel(model, tokenizer=tokenizer, bos_id=word2idx["[CLS]"], eos_id=word2idx["[SEP]"], device=self.device)
Expand Down

0 comments on commit 5e32826

Please sign in to comment.