Feature Extraction
Transformers
PyTorch
Safetensors
English
magi
Manga
Object Detection
OCR
Clustering
Diarisation
custom_code
Instructions to use ragavsachdeva/magi with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ragavsachdeva/magi with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="ragavsachdeva/magi", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ragavsachdeva/magi", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
| from transformers import PretrainedConfig, VisionEncoderDecoderConfig | |
| from typing import List | |
| class MagiConfig(PretrainedConfig): | |
| model_type = "magi" | |
| def __init__( | |
| self, | |
| disable_ocr: bool = False, | |
| disable_crop_embeddings: bool = False, | |
| disable_detections: bool = False, | |
| detection_model_config: dict = None, | |
| ocr_model_config: dict = None, | |
| crop_embedding_model_config: dict = None, | |
| detection_image_preprocessing_config: dict = None, | |
| ocr_pretrained_processor_path: str = None, | |
| crop_embedding_image_preprocessing_config: dict = None, | |
| **kwargs, | |
| ): | |
| self.disable_ocr = disable_ocr | |
| self.disable_crop_embeddings = disable_crop_embeddings | |
| self.disable_detections = disable_detections | |
| self.detection_model_config = None | |
| self.ocr_model_config = None | |
| self.crop_embedding_model_config = None | |
| if detection_model_config is not None: | |
| self.detection_model_config = PretrainedConfig.from_dict(detection_model_config) | |
| if ocr_model_config is not None: | |
| self.ocr_model_config = VisionEncoderDecoderConfig.from_dict(ocr_model_config) | |
| if crop_embedding_model_config is not None: | |
| self.crop_embedding_model_config = PretrainedConfig.from_dict(crop_embedding_model_config) | |
| self.detection_image_preprocessing_config = detection_image_preprocessing_config | |
| self.ocr_pretrained_processor_path = ocr_pretrained_processor_path | |
| self.crop_embedding_image_preprocessing_config = crop_embedding_image_preprocessing_config | |
| super().__init__(**kwargs) | |