danielhanchen commited on
Commit
af03e36
·
verified ·
1 Parent(s): 425319b

Update modeling_deepseekv2.py

Browse files
Files changed (1) hide show
  1. modeling_deepseekv2.py +8 -4
modeling_deepseekv2.py CHANGED
@@ -34,10 +34,14 @@ from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
34
  from transformers.activations import ACT2FN
35
  from transformers.cache_utils import Cache, DynamicCache
36
  from transformers.modeling_attn_mask_utils import _prepare_4d_causal_attention_mask
37
- from transformers.models.llama.modeling_llama import (
38
- LlamaAttention,
39
- LlamaFlashAttention2
40
- )
 
 
 
 
41
  from transformers.modeling_outputs import (
42
  BaseModelOutputWithPast,
43
  CausalLMOutputWithPast,
 
34
  from transformers.activations import ACT2FN
35
  from transformers.cache_utils import Cache, DynamicCache
36
  from transformers.modeling_attn_mask_utils import _prepare_4d_causal_attention_mask
37
+ try:
38
+ from transformers.models.llama.modeling_llama import LlamaAttention
39
+ except:
40
+ LlamaAttention = None
41
+ try:
42
+ from transformers.models.llama.modeling_llama import LlamaFlashAttention2
43
+ except:
44
+ LlamaFlashAttention2 = None
45
  from transformers.modeling_outputs import (
46
  BaseModelOutputWithPast,
47
  CausalLMOutputWithPast,