This commit is contained in:
Michał Kozłowski 2022-12-16 15:24:37 +01:00
parent ed4cabfe35
commit ff2ba1533a

View File

@ -15,11 +15,11 @@ from sconf import Config
def main(config): def main(config):
max_length = 768 # max_length = 768
image_size = [1920, 2560] # image_size = [1920, 2560]
config_vision = VisionEncoderDecoderConfig.from_pretrained(config.pretrained_model_path) # config_vision = VisionEncoderDecoderConfig.from_pretrained(config.pretrained_model_path)
config_vision.encoder.image_size = image_size # (height, width) # config_vision.encoder.image_size = image_size # (height, width)
config_vision.decoder.max_length = max_length # config_vision.decoder.max_length = max_length
processor = DonutProcessor.from_pretrained(config.pretrained_processor_path) processor = DonutProcessor.from_pretrained(config.pretrained_processor_path)
model = VisionEncoderDecoderModel.from_pretrained(config.pretrained_model_path, config=config) model = VisionEncoderDecoderModel.from_pretrained(config.pretrained_model_path, config=config)