Transformers
PyTorch
English
limon
neural-ode
flow-matching
experimental
lightweight
research
limonai
custom_code
Instructions to use LimonAI/LimonF-v1-8M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LimonAI/LimonF-v1-8M with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("LimonAI/LimonF-v1-8M", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Upload modeling_limon.py
Browse files- modeling_limon.py +9 -2
modeling_limon.py
CHANGED
|
@@ -86,8 +86,15 @@ class LimonFlowV1Model(PreTrainedModel):
|
|
| 86 |
x = self.embeddings(input_ids) + self.pos_embeddings(pos)
|
| 87 |
x = self.ode_solver(x)
|
| 88 |
logits = self.head(x)
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
def prepare_inputs_for_generation(self, input_ids, **kwargs):
|
| 93 |
return {"input_ids": input_ids}
|
|
|
|
| 86 |
x = self.embeddings(input_ids) + self.pos_embeddings(pos)
|
| 87 |
x = self.ode_solver(x)
|
| 88 |
logits = self.head(x)
|
| 89 |
+
|
| 90 |
+
loss = None
|
| 91 |
+
if labels is not None:
|
| 92 |
+
loss = F.cross_entropy(logits.view(-1, self.config.vocab_size), labels.view(-1))
|
| 93 |
+
|
| 94 |
+
return {
|
| 95 |
+
"logits": logits,
|
| 96 |
+
"loss": loss
|
| 97 |
+
}
|
| 98 |
|
| 99 |
def prepare_inputs_for_generation(self, input_ids, **kwargs):
|
| 100 |
return {"input_ids": input_ids}
|