stupidog04 commited on
Commit
be4d4fb
1 Parent(s): 8f0d639

Delete pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +0 -31
pipeline.py DELETED
@@ -1,31 +0,0 @@
1
- from torchvision import transforms
2
- from pair_classification import PairClassificationPipeline
3
-
4
- class PreTrainedPipeline():
5
- def __init__(self, path):
6
- """
7
- Initialize model
8
- """
9
- model_flag = 'google/vit-base-patch16-224-in21k'
10
- # self.processor = feature_extractor = ViTFeatureExtractor.from_pretrained(model_flag)
11
- self.pipe = pipeline("pair-classification", model=model_flag , feature_extractor=model_flag ,
12
- model_kwargs={'num_labels':len(label2id),
13
- 'label2id':label2id,
14
- 'id2label':id2label,
15
- 'num_channels':6,
16
- 'ignore_mismatched_sizes': True })
17
- self.model = self.pipe.model.from_pretrained(path)
18
-
19
-
20
- def __call__(self, inputs):
21
- """
22
- Args:
23
- inputs (:obj:`np.array`):
24
- The raw waveform of audio received. By default at 16KHz.
25
- Return:
26
- A :obj:`dict`:. The object return should be liked {"text": "XXX"} containing
27
- the detected text from the input audio.
28
- """
29
- # input_values = self.processor(inputs, return_tensors="pt", sampling_rate=self.sampling_rate).input_values # Batch size 1
30
- # logits = self.model(input_values).logits.cpu().detach().numpy()[0]
31
- return self.pipe(inputs)