def get_batch(context_tokens, device, args): tokens = context_tokens tokens = tokens.view(args.batch_size, -1).contiguous() tokens = tokens.to(device) # Get the masks and postition ids. attention_mask, loss_mask, position_ids = get_masks_and_position_ids( tokens, args.eod_token, args.reset_position_ids, args.reset_attention_mask) return tokens, attention_mask, position_ids
def get_batch(context_tokens, device, args): tokens = context_tokens tokens = tokens.view(args.batch_size, -1).contiguous() tokens = tokens.to(device) # Get the masks and postition ids. attention_mask, loss_mask, position_ids = get_masks_and_position_ids( tokens, args.eod_token, reset_position_ids=False, reset_attention_mask=False, transformer_xl=args.transformer_xl, mem_length=args.mem_length) return tokens, attention_mask, position_ids