Instructions to use p1atdev/MangaLineExtraction-hf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use p1atdev/MangaLineExtraction-hf with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-image" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # pip install "transformers<5.0.0" from transformers import pipeline pipe = pipeline("image-to-image", model="p1atdev/MangaLineExtraction-hf", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("p1atdev/MangaLineExtraction-hf", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download configuration_mle.py from p1atdev/MangaLineExtraction-hf: direct link, hf CLI and curl.
- Browser
- Download file 1.45 kB
-
https://huggingface.co/p1atdev/MangaLineExtraction-hf/resolve/refs%2Fpr%2F2/configuration_mle.py
- Command line
-
hf download hf://p1atdev/MangaLineExtraction-hf@refs/pr/2/configuration_mle.py
-
curl -L -o configuration_mle.py https://huggingface.co/p1atdev/MangaLineExtraction-hf/resolve/refs%2Fpr%2F2/configuration_mle.py
1.45 kB
| from collections import OrderedDict | |
| from typing import Any, List, Mapping, Optional | |
| from transformers.configuration_utils import PretrainedConfig | |
| from transformers.onnx import OnnxConfigWithPast, PatchingSpec | |
| from transformers.utils import logging | |
| logger = logging.get_logger(__name__) | |
| class MLEConfig(PretrainedConfig): | |
| model_type = "mle" | |
| def __init__( | |
| self, | |
| in_channels=1, | |
| num_encoder_layers=[2, 3, 5, 7, 12], | |
| num_decoder_layers=[7, 5, 3, 2, 2], | |
| last_hidden_channels=16, | |
| block_stride_size=4, | |
| block_kernel_size=3, | |
| block_patch_size=24, | |
| upsample_ratio=2, | |
| batch_norm_eps=1e-3, | |
| hidden_act="leaky_relu", | |
| negative_slope=0.2, | |
| **kwargs, | |
| ): | |
| self.in_channels = in_channels | |
| self.num_encoder_layers = num_encoder_layers | |
| self.num_decoder_layers = num_decoder_layers | |
| self.last_hidden_channels = last_hidden_channels | |
| self.block_stride_size = block_stride_size | |
| # if isinstance(block_kernel_size, int): | |
| # self.block_kernel_size = (block_kernel_size, block_kernel_size) | |
| self.block_kernel_size = block_kernel_size | |
| self.block_patch_size = block_patch_size | |
| self.upsample_ratio = upsample_ratio | |
| self.batch_norm_eps = batch_norm_eps | |
| self.hidden_act = hidden_act | |
| self.negative_slope = negative_slope | |
| super().__init__(**kwargs) | |