kevin-pek commited on
Commit
82eb988
1 Parent(s): eab2e32

try using NougatProcessor using custom transformer version

Browse files
Files changed (3) hide show
  1. handler.py +2 -2
  2. preprocessor_config.json +2 -2
  3. tokenizer_config.json +2 -2
handler.py CHANGED
@@ -1,13 +1,13 @@
1
  from io import BytesIO
2
  from typing import Dict, Any
3
- from transformers import AutoProcessor, VisionEncoderDecoderModel
4
  from transformers.image_utils import base64
5
  from PIL import Image
6
  import torch
7
 
8
  class EndpointHandler():
9
  def __init__(self, path="facebook/nougat-base") -> None:
10
- self.processor = AutoProcessor.from_pretrained(path)
11
  self.model = VisionEncoderDecoderModel.from_pretrained(path)
12
 
13
  self.device = "cuda" if torch.cuda.is_available() else "cpu"
 
1
  from io import BytesIO
2
  from typing import Dict, Any
3
+ from transformers import NougatProcessor, VisionEncoderDecoderModel
4
  from transformers.image_utils import base64
5
  from PIL import Image
6
  import torch
7
 
8
  class EndpointHandler():
9
  def __init__(self, path="facebook/nougat-base") -> None:
10
+ self.processor = NougatProcessor.from_pretrained(path)
11
  self.model = VisionEncoderDecoderModel.from_pretrained(path)
12
 
13
  self.device = "cuda" if torch.cuda.is_available() else "cpu"
preprocessor_config.json CHANGED
@@ -11,13 +11,13 @@
11
  0.456,
12
  0.406
13
  ],
14
- "image_processor_type": "AutoProcessor",
15
  "image_std": [
16
  0.229,
17
  0.224,
18
  0.225
19
  ],
20
- "processor_class": "AutoProcessor",
21
  "resample": 2,
22
  "rescale_factor": 0.00392156862745098,
23
  "size": {
 
11
  0.456,
12
  0.406
13
  ],
14
+ "image_processor_type": "NougatImageProcessor",
15
  "image_std": [
16
  0.229,
17
  0.224,
18
  0.225
19
  ],
20
+ "processor_class": "NougatProcessor",
21
  "resample": 2,
22
  "rescale_factor": 0.00392156862745098,
23
  "size": {
tokenizer_config.json CHANGED
@@ -195,9 +195,9 @@
195
  "pad_token": "<pad>",
196
  "pad_token_type_id": 0,
197
  "padding_side": "right",
198
- "processor_class": "AutoProcessor",
199
  "stride": 0,
200
- "tokenizer_class": "AutoTokenizer",
201
  "truncation_side": "right",
202
  "truncation_strategy": "longest_first",
203
  "unk_token": "<unk>",
 
195
  "pad_token": "<pad>",
196
  "pad_token_type_id": 0,
197
  "padding_side": "right",
198
+ "processor_class": "NougatProcessor",
199
  "stride": 0,
200
+ "tokenizer_class": "NougatTokenizer",
201
  "truncation_side": "right",
202
  "truncation_strategy": "longest_first",
203
  "unk_token": "<unk>",