HemanthSai7 commited on
Commit
3749884
·
verified ·
1 Parent(s): 3188a15

Fix imports and corrupted Ellipsis for trust_remote_code loading

Browse files
Files changed (1) hide show
  1. modeling_nandi.py +3 -3
modeling_nandi.py CHANGED
@@ -30,7 +30,7 @@ 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 .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
@@ -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[transformers., : x.shape[-1] // 2]
113
- x2 = x[transformers., x.shape[-1] // 2 :]
114
  return torch.cat((-x2, x1), dim=-1)
115
 
116
 
 
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
 
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