Update quality tooling for formatting (#21480)
* Result of black 23.1 * Update target to Python 3.7 * Switch flake8 to ruff * Configure isort * Configure isort * Apply isort with line limit * Put the right black version * adapt black in check copies * Fix copies
This commit is contained in:
@@ -264,7 +264,6 @@ class BARTGenerator(torch.nn.Module, GenerationMixin):
|
||||
|
||||
past: List[torch.Tensor] = []
|
||||
while cur_len < max_length:
|
||||
|
||||
logits, past = self._decoder_forward(input_ids, encoder_output, attention_mask, past)
|
||||
next_token_logits = logits[:, -1, :]
|
||||
|
||||
@@ -303,7 +302,6 @@ class BARTGenerator(torch.nn.Module, GenerationMixin):
|
||||
decoder_start_token_id,
|
||||
bos_token_id: Optional[int] = None,
|
||||
) -> torch.LongTensor:
|
||||
|
||||
decoder_input_ids = (
|
||||
torch.ones((input_ids.shape[0], 1), dtype=input_ids.dtype, device=input_ids.device)
|
||||
* decoder_start_token_id
|
||||
@@ -633,7 +631,6 @@ class BARTBeamSearchGenerator(BARTGenerator):
|
||||
def beam_search(
|
||||
self, input_ids, encoder_output, attention_mask, num_beams, max_length, pad_token_id: int, eos_token_id: int
|
||||
):
|
||||
|
||||
batch_size = self.beam_scorer.batch_size
|
||||
|
||||
num_beams = self.beam_scorer.num_beams
|
||||
|
||||
@@ -5,7 +5,6 @@ Code to remove duplicate initializers to reduce ONNX model size.
|
||||
import os
|
||||
|
||||
import numpy
|
||||
|
||||
import onnx
|
||||
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ import os
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
import onnxruntime
|
||||
import transformers
|
||||
import torch
|
||||
from bart_onnx.generation_onnx import BARTBeamSearchGenerator
|
||||
from bart_onnx.reduce_onnx_size import remove_dup_initializers
|
||||
|
||||
import transformers
|
||||
from transformers import BartForConditionalGeneration, BartTokenizer
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user