from transformers import PreTrainedModel | |
from typing import Optional | |
import torch | |
class MinerUModel(PreTrainedModel): | |
def __init__(self, config): | |
super().__init__(config) | |
self.config = config | |
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) |