Instructions to use mineself2016/GeneMamba with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mineself2016/GeneMamba with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="mineself2016/GeneMamba", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mineself2016/GeneMamba", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Remove stale file: 48l-512d/modeling_outputs.py
Browse files- 48l-512d/modeling_outputs.py +0 -81
48l-512d/modeling_outputs.py
DELETED
|
@@ -1,81 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Custom ModelOutput classes for GeneMamba.
|
| 3 |
-
Defines the output structure for different GeneMamba tasks.
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
from dataclasses import dataclass
|
| 7 |
-
from typing import Optional, Tuple
|
| 8 |
-
import torch
|
| 9 |
-
from transformers.utils import ModelOutput
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
@dataclass
|
| 13 |
-
class GeneMambaModelOutput(ModelOutput):
|
| 14 |
-
"""
|
| 15 |
-
Base output class for GeneMamba models.
|
| 16 |
-
|
| 17 |
-
Attributes:
|
| 18 |
-
last_hidden_state (torch.FloatTensor of shape (batch_size, sequence_length, hidden_size)):
|
| 19 |
-
Sequence of hidden-states at the output of the last layer of the model.
|
| 20 |
-
|
| 21 |
-
hidden_states (tuple(torch.FloatTensor), optional):
|
| 22 |
-
Hidden-states of the model at the output of each layer plus the initial embedding outputs.
|
| 23 |
-
|
| 24 |
-
pooled_embedding (torch.FloatTensor of shape (batch_size, hidden_size)):
|
| 25 |
-
Cell/sequence-level embedding (pooled representation) used for downstream tasks.
|
| 26 |
-
This is the recommended embedding to use for classification, clustering, etc.
|
| 27 |
-
|
| 28 |
-
embedding_pooling (str):
|
| 29 |
-
The pooling method used to generate pooled_embedding.
|
| 30 |
-
"""
|
| 31 |
-
|
| 32 |
-
last_hidden_state: torch.FloatTensor = None
|
| 33 |
-
hidden_states: Optional[Tuple[torch.FloatTensor]] = None
|
| 34 |
-
pooled_embedding: torch.FloatTensor = None
|
| 35 |
-
embedding_pooling: str = "mean"
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
@dataclass
|
| 39 |
-
class GeneMambaSequenceClassifierOutput(ModelOutput):
|
| 40 |
-
"""
|
| 41 |
-
Output class for GeneMamba sequence classification models.
|
| 42 |
-
|
| 43 |
-
Attributes:
|
| 44 |
-
loss (torch.FloatTensor of shape (), optional):
|
| 45 |
-
Classification loss (if labels were provided).
|
| 46 |
-
|
| 47 |
-
logits (torch.FloatTensor of shape (batch_size, num_labels)):
|
| 48 |
-
Classification scores (before softmax).
|
| 49 |
-
|
| 50 |
-
hidden_states (tuple(torch.FloatTensor), optional):
|
| 51 |
-
Hidden-states of the model at the output of each layer.
|
| 52 |
-
|
| 53 |
-
pooled_embedding (torch.FloatTensor of shape (batch_size, hidden_size), optional):
|
| 54 |
-
Cell embedding before classification head.
|
| 55 |
-
"""
|
| 56 |
-
|
| 57 |
-
loss: Optional[torch.FloatTensor] = None
|
| 58 |
-
logits: torch.FloatTensor = None
|
| 59 |
-
hidden_states: Optional[Tuple[torch.FloatTensor]] = None
|
| 60 |
-
pooled_embedding: Optional[torch.FloatTensor] = None
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
@dataclass
|
| 64 |
-
class GeneMambaMaskedLMOutput(ModelOutput):
|
| 65 |
-
"""
|
| 66 |
-
Output class for GeneMamba masked language modeling.
|
| 67 |
-
|
| 68 |
-
Attributes:
|
| 69 |
-
loss (torch.FloatTensor of shape (), optional):
|
| 70 |
-
MLM loss (if labels were provided).
|
| 71 |
-
|
| 72 |
-
logits (torch.FloatTensor of shape (batch_size, sequence_length, vocab_size)):
|
| 73 |
-
Prediction scores of the language modeling head.
|
| 74 |
-
|
| 75 |
-
hidden_states (tuple(torch.FloatTensor), optional):
|
| 76 |
-
Hidden-states of the model at the output of each layer.
|
| 77 |
-
"""
|
| 78 |
-
|
| 79 |
-
loss: Optional[torch.FloatTensor] = None
|
| 80 |
-
logits: torch.FloatTensor = None
|
| 81 |
-
hidden_states: Optional[Tuple[torch.FloatTensor]] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|