Instructions to use TomokiFujihara/luke-japanese-base-lite-offensiveness-estimation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TomokiFujihara/luke-japanese-base-lite-offensiveness-estimation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="TomokiFujihara/luke-japanese-base-lite-offensiveness-estimation", trust_remote_code=True)# Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("TomokiFujihara/luke-japanese-base-lite-offensiveness-estimation", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
| from transformers import PretrainedConfig | |
| from typing import List | |
| class OffensivenessEstimationConfig(PretrainedConfig): | |
| model_type = "offensiveness_estimation" | |
| def __init__( | |
| self, | |
| language_model: str = 'studio-ousia/luke-japanese-base-lite', | |
| output_class_num: int = 11, | |
| reinit_n_layers: int = 1, | |
| dropout_rate: float = 0.1, | |
| **kwargs, | |
| ): | |
| # if block_type not in ["basic", "bottleneck"]: | |
| # raise ValueError(f"`block_type` must be 'basic' or bottleneck', got {block_type}.") | |
| # if stem_type not in ["", "deep", "deep-tiered"]: | |
| # raise ValueError(f"`stem_type` must be '', 'deep' or 'deep-tiered', got {stem_type}.") | |
| self.language_model = language_model | |
| self.output_class_num = output_class_num | |
| self.reinit_n_layers = reinit_n_layers | |
| self.dropout_rate = dropout_rate | |
| super().__init__(**kwargs) |