Upload modeling_decicoder.py with huggingface_hub
Browse files- modeling_decicoder.py +6 -0
modeling_decicoder.py
CHANGED
@@ -8,6 +8,12 @@ import torch
|
|
8 |
import torch.nn.functional as F
|
9 |
import torch.utils.checkpoint
|
10 |
from torch import nn
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
from transformers.models.llama.modeling_llama import LlamaMLP, LlamaRMSNorm, LlamaAttention, apply_rotary_pos_emb, \
|
12 |
repeat_kv, LlamaPreTrainedModel, LLAMA_START_DOCSTRING, LlamaDecoderLayer, LlamaForCausalLM, LlamaModel
|
13 |
from transformers.utils import add_start_docstrings
|
|
|
8 |
import torch.nn.functional as F
|
9 |
import torch.utils.checkpoint
|
10 |
from torch import nn
|
11 |
+
from packaging import version
|
12 |
+
import transformers
|
13 |
+
if version.parse(transformers.__version__) < version.parse("4.31.0"):
|
14 |
+
raise ImportError(
|
15 |
+
f"You are using transformers=={transformers.__version__}, but transformers>=4.31.0 is required to use DeciCoder. Please upgrade transformers."
|
16 |
+
)
|
17 |
from transformers.models.llama.modeling_llama import LlamaMLP, LlamaRMSNorm, LlamaAttention, apply_rotary_pos_emb, \
|
18 |
repeat_kv, LlamaPreTrainedModel, LLAMA_START_DOCSTRING, LlamaDecoderLayer, LlamaForCausalLM, LlamaModel
|
19 |
from transformers.utils import add_start_docstrings
|