Skip to content

Commit

Permalink
add_model_train
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengyanzhao committed Apr 28, 2021
1 parent e6795be commit 05cd475
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def forward(self, input_ids, attention_mask,token_type_ids,c):
def train(dataloader, model, loss_fn, optimizer):
size = len(dataloader.dataset)
correct = 0
model.train()
for batch, (data,y,c) in enumerate(dataloader):
input_ids = data['input_ids'].to(device)
attention_mask = data['attention_mask'].to(device)
Expand Down
1 change: 1 addition & 0 deletions model/model/Torch_model/Souhu_TextMatch/Nezha_1024.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def forward(self, input_ids, attention_mask, token_type_ids, c):
def train(dataloader, model, loss_fn, optimizer):
size = len(dataloader.dataset)
correct = 0
model.train()
for batch, (data, y, c) in enumerate(dataloader):
input_ids = data['input_ids'].to(device)
attention_mask = data['attention_mask'].to(device)
Expand Down
1 change: 1 addition & 0 deletions model/model/Torch_model/Souhu_TextMatch/P-tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def forward(self, input_ids, attention_mask, token_type_ids):
def train(dataloader, model, loss_fn, optimizer):
size = len(dataloader.dataset)
correct = 0
model.train()
for batch, (data,y,_) in enumerate(dataloader):
input_ids = data['input_ids'].to(device)
attention_mask = data['attention_mask'].to(device)
Expand Down

0 comments on commit 05cd475

Please sign in to comment.