The TDAMM (Time Domain Multi-Messenger Astronomy) model v2 is created to categorize NASA's time domain multi-messenger resources into one or more of 36 distinct categories identified by subject matter experts (SMEs).
This is an updated version fine-tuned from
INDUS-SDE, a domain-adapted language model for Scientific Content Curation & Discovery in noisy context.
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4tokenizer = AutoTokenizer.from_pretrained("nasa-impact/tdamm-classification-v2")
5model = AutoModelForSequenceClassification.from_pretrained("nasa-impact/tdamm-classification-v2")
6
7# Prepare input
8text = "Your astronomical text here"
9inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=512)
10
11# Get predictions
12with torch.no_grad():
13 outputs = model(**inputs)
14 predictions = torch.sigmoid(outputs.logits)
15
16# Convert to binary predictions (threshold = 0.5)
17binary_predictions = (predictions > 0.5).int()
18
19# Get predicted label indices
20predicted_indices = torch.where(binary_predictions[0] == 1)[0].tolist()
21print(f"Predicted indices: {predicted_indices}")
After obtaining predictions from the model, you can map the predicted label indices to their actual names using the model.config.id2label dictionary:
1# Example usage
2predicted_indices = [0, 2, 5]
3predicted_labels = [model.config.id2label[idx] for idx in predicted_indices]
4print(predicted_labels)
1@misc{tdamm-classification-v2,
2 author = {NASA IMPACT},
3 title = {TDAMM Multi-Label Classification Model v2},
4 year = {2025},
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/nasa-impact/tdamm-classification-v2}
7}