File size: 646 Bytes
d282272 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from transformers import PreTrainedModel
from typing import Optional
import torch
class MinerUModel(PreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.config = config
@staticmethod
def load_model():
from model_loader import MinerUModelLoader
return MinerUModelLoader.load_models("./")
def forward(self, input_data):
# 实现前向传播逻辑
pass
def load_model():
model = MinerUModel.from_pretrained("./")
return model
def inference(pdf_content):
model = load_model()
return model(pdf_content) |