Upload folder using huggingface_hub
Browse files- architecture.py +4 -1
- config.json +3 -4
architecture.py
CHANGED
|
@@ -4,7 +4,9 @@ import torch
|
|
| 4 |
import torch.nn as nn
|
| 5 |
import torch.nn.functional as F
|
| 6 |
from typing import Optional, Dict
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
# This file contains the custom nn.Module definitions required by the fine-tuned model.
|
| 9 |
# By placing them here, the main training script is cleaner, and more importantly,
|
| 10 |
# this file can be packaged with the model for easy loading from the Hugging Face Hub.
|
|
@@ -115,4 +117,5 @@ class GCVectorMemoryLayer(nn.Module):
|
|
| 115 |
|
| 116 |
return corrected_activation
|
| 117 |
|
|
|
|
| 118 |
# --- END OF FILE architecture.py ---
|
|
|
|
| 4 |
import torch.nn as nn
|
| 5 |
import torch.nn.functional as F
|
| 6 |
from typing import Optional, Dict
|
| 7 |
+
from transformers import AutoConfig, AutoModelForCausalLM
|
| 8 |
+
from transformers.models.phi3.configuration_phi3 import Phi3Config
|
| 9 |
+
from transformers.models.phi3.modeling_phi3 import Phi3ForCausalLM
|
| 10 |
# This file contains the custom nn.Module definitions required by the fine-tuned model.
|
| 11 |
# By placing them here, the main training script is cleaner, and more importantly,
|
| 12 |
# this file can be packaged with the model for easy loading from the Hugging Face Hub.
|
|
|
|
| 117 |
|
| 118 |
return corrected_activation
|
| 119 |
|
| 120 |
+
AutoModelForCausalLM.register(Phi3Config, Phi3WithVectorMemoryForCausalLM)
|
| 121 |
# --- END OF FILE architecture.py ---
|
config.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
| 1 |
{
|
| 2 |
"architectures": [
|
| 3 |
-
"
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
"auto_map": {
|
| 8 |
-
"
|
| 9 |
-
"AutoModelForCausalLM": "microsoft/Phi-3-mini-4k-instruct--modeling_phi3.Phi3ForCausalLM"
|
| 10 |
},
|
| 11 |
"bos_token_id": 1,
|
| 12 |
"embd_pdrop": 0.0,
|
|
@@ -32,4 +31,4 @@
|
|
| 32 |
"transformers_version": "4.52.4",
|
| 33 |
"use_cache": true,
|
| 34 |
"vocab_size": 32064
|
| 35 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
"architectures": [
|
| 3 |
+
"Phi3WithVectorMemoryForCausalLM"
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
"auto_map": {
|
| 8 |
+
"AutoModelForCausalLM": "architecture.Phi3WithVectorMemoryForCausalLM"
|
|
|
|
| 9 |
},
|
| 10 |
"bos_token_id": 1,
|
| 11 |
"embd_pdrop": 0.0,
|
|
|
|
| 31 |
"transformers_version": "4.52.4",
|
| 32 |
"use_cache": true,
|
| 33 |
"vocab_size": 32064
|
| 34 |
+
}
|