HemanthSai7 commited on
Commit
04e5e05
·
verified ·
1 Parent(s): 61f43f8

Update modeling_nandi.py

Browse files
Files changed (1) hide show
  1. modeling_nandi.py +16 -16
modeling_nandi.py CHANGED
@@ -23,20 +23,20 @@ from collections.abc import Callable
23
  import torch
24
  import torch.nn as nn
25
 
26
- from ...activations import ACT2FN
27
- from ...cache_utils import Cache, DynamicCache, DynamicLayer
28
- from ...generation import GenerationMixin
29
- from ...integrations import use_kernel_forward_from_hub
30
- from ...masking_utils import create_causal_mask
31
- from ...modeling_layers import GradientCheckpointingLayer
32
- from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
33
- from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
34
- from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
35
- from ...processing_utils import Unpack
36
- from ...utils import TransformersKwargs, auto_docstring
37
- from ...utils.deprecation import deprecate_kwarg
38
- from ...utils.generic import can_return_tuple, merge_with_config_defaults
39
- from ...utils.output_capturing import capture_outputs
40
  from .configuration_nandi import NandiConfig
41
 
42
 
@@ -109,8 +109,8 @@ class NandiRotaryEmbedding(nn.Module):
109
 
110
  def rotate_half(x):
111
  """Rotates half the hidden dims of the input."""
112
- x1 = x[..., : x.shape[-1] // 2]
113
- x2 = x[..., x.shape[-1] // 2 :]
114
  return torch.cat((-x2, x1), dim=-1)
115
 
116
 
 
23
  import torch
24
  import torch.nn as nn
25
 
26
+ from transformers.activations import ACT2FN
27
+ from transformers.cache_utils import Cache, DynamicCache, DynamicLayer
28
+ from transformers.generation import GenerationMixin
29
+ from transformers.integrations import use_kernel_forward_from_hub
30
+ from transformers.masking_utils import create_causal_mask
31
+ from transformers.modeling_layers import GradientCheckpointingLayer
32
+ from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
33
+ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
34
+ from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
35
+ from transformers.processing_utils import Unpack
36
+ from transformers.utils import TransformersKwargs, auto_docstring
37
+ from transformers.utils.deprecation import deprecate_kwarg
38
+ from transformers.utils.generic import can_return_tuple, merge_with_config_defaults
39
+ from transformers.utils.output_capturing import capture_outputs
40
  from .configuration_nandi import NandiConfig
41
 
42
 
 
109
 
110
  def rotate_half(x):
111
  """Rotates half the hidden dims of the input."""
112
+ x1 = x[transformers., : x.shape[-1] // 2]
113
+ x2 = x[transformers., x.shape[-1] // 2 :]
114
  return torch.cat((-x2, x1), dim=-1)
115
 
116