|
|
--- |
|
|
base_model: |
|
|
- nasa-impact/nasa-smd-ibm-v0.1 |
|
|
tags: |
|
|
- single-label |
|
|
pipeline_tag: text-classification |
|
|
library_name: transformers |
|
|
--- |
|
|
# Division Classification Model |
|
|
|
|
|
This is a single label classification task for automated tagging of documents in Science Discovery Engine. Based on [INDUS Model](https://huggingface.co/nasa-impact/nasa-smd-ibm-v0.1) |
|
|
|
|
|
The idx to label mapping is: |
|
|
``` |
|
|
"0": "Astrophysics", |
|
|
"1": "Biological and Physical Sciences", |
|
|
"2": "Earth Science", |
|
|
"3": "Heliophysics", |
|
|
"4": "Planetary Science" |
|
|
``` |
|
|
|
|
|
## Data distribution |
|
|
|
|
|
 |
|
|
|
|
|
## Evalution of the model: |
|
|
|
|
|
 |
|
|
|
|
|
|
|
|
 |
|
|
|
|
|
|
|
|
## How to Use |
|
|
You can load this model using the Hugging Face 🤗 Transformers library: |
|
|
|
|
|
### Using the Pipeline |
|
|
```python |
|
|
from transformers import pipeline |
|
|
|
|
|
classifier = pipeline("text-classification", model="nasa-impact/division-classifier") |
|
|
prediction = classifier("Your input text", truncation=True, padding="max_length", max_length=512) |
|
|
print(prediction) |
|
|
``` |
|
|
|
|
|
### Using the Model |
|
|
```python |
|
|
from transformers import AutoTokenizer, AutoModelForSequenceClassification |
|
|
model_name = "nasa-impact/division-classifier" |
|
|
tokenizer = AutoTokenizer.from_pretrained(model_name) |
|
|
model = AutoModelForSequenceClassification.from_pretrained(model_name) |
|
|
|
|
|
inputs = tokenizer("Your input text", return_tensors="pt", truncation=True, max_length=512, padding="max_length") |
|
|
outputs = model(**inputs) |
|
|
predicted_label = outputs.logits.argmax(-1).item() |
|
|
print(predicted_label) |
|
|
``` |