Upload 2 files
Browse files- modeling_lumenspark.py +5 -2
modeling_lumenspark.py
CHANGED
@@ -1,5 +1,5 @@
|
|
|
|
1 |
from lumenspark.configuration_lumenspark import LumensparkConfig
|
2 |
-
from transformers import PreTrainedModel, GPT2Tokenizer
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
from safetensors import safe_open
|
5 |
from torch import nn
|
@@ -292,4 +292,7 @@ class LumensparkModel(PreTrainedModel):
|
|
292 |
loss_fct = nn.CrossEntropyLoss()
|
293 |
loss = loss_fct(shift_logits, shift_labels)
|
294 |
|
295 |
-
return {"loss": loss, "logits": logits}
|
|
|
|
|
|
|
|
1 |
+
from transformers import PreTrainedModel, GPT2Tokenizer, AutoConfig, AutoModelForCausalLM
|
2 |
from lumenspark.configuration_lumenspark import LumensparkConfig
|
|
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
from safetensors import safe_open
|
5 |
from torch import nn
|
|
|
292 |
loss_fct = nn.CrossEntropyLoss()
|
293 |
loss = loss_fct(shift_logits, shift_labels)
|
294 |
|
295 |
+
return {"loss": loss, "logits": logits}
|
296 |
+
|
297 |
+
AutoConfig.register("lumenspark", LumensparkConfig)
|
298 |
+
AutoModelForCausalLM.register(LumensparkConfig, LumensparkModel)
|