Sarikaa-Sridhar commited on
Commit
514fc8a
·
verified ·
1 Parent(s): 9079f0c

Delete processing_yield.py

Browse files
Files changed (1) hide show
  1. processing_yield.py +0 -37
processing_yield.py DELETED
@@ -1,37 +0,0 @@
1
- # processing_yield.py
2
-
3
- import json
4
- from transformers.processing_utils import ProcessorMixin
5
-
6
-
7
- class YieldProcessor(ProcessorMixin):
8
- attributes = []
9
- valid_kwargs = []
10
-
11
- def __init__(self, **kwargs):
12
- super().__init__()
13
-
14
- def __call__(self, inputs=None, **kwargs):
15
- """
16
- Accept either:
17
- 1. the existing dictionary input, or
18
- 2. a JSON string containing that dictionary.
19
- """
20
- if inputs is None:
21
- inputs = kwargs
22
-
23
- if isinstance(inputs, str):
24
- try:
25
- inputs = json.loads(inputs)
26
- except json.JSONDecodeError as e:
27
- raise ValueError(
28
- "YieldProcessor expected a JSON string "
29
- "representing the model input."
30
- ) from e
31
-
32
- if not isinstance(inputs, dict):
33
- raise ValueError(
34
- "YieldProcessor expects a dictionary or JSON string."
35
- )
36
-
37
- return inputs