File tree Expand file tree Collapse file tree 14 files changed +14
-27
lines changed
templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}} Expand file tree Collapse file tree 14 files changed +14
-27
lines changed Original file line number Diff line number Diff line change @@ -693,12 +693,12 @@ def forward(
693
693
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
694
694
elif input_ids is not None :
695
695
input_shape = input_ids .size ()
696
- batch_size , seq_length = input_shape
697
696
elif inputs_embeds is not None :
698
697
input_shape = inputs_embeds .size ()[:- 1 ]
699
698
else :
700
699
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
701
700
701
+ batch_size , seq_length = input_shape
702
702
device = input_ids .device if input_ids is not None else inputs_embeds .device
703
703
704
704
if attention_mask is None :
Original file line number Diff line number Diff line change @@ -936,13 +936,12 @@ def forward(
936
936
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
937
937
elif input_ids is not None :
938
938
input_shape = input_ids .size ()
939
- batch_size , seq_length = input_shape
940
939
elif inputs_embeds is not None :
941
940
input_shape = inputs_embeds .size ()[:- 1 ]
942
- batch_size , seq_length = input_shape
943
941
else :
944
942
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
945
943
944
+ batch_size , seq_length = input_shape
946
945
device = input_ids .device if input_ids is not None else inputs_embeds .device
947
946
948
947
# past_key_values_length
Original file line number Diff line number Diff line change @@ -353,13 +353,12 @@ def forward(
353
353
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
354
354
elif input_ids is not None :
355
355
input_shape = input_ids .size ()
356
- batch_size , seq_length = input_shape
357
356
elif inputs_embeds is not None :
358
357
input_shape = inputs_embeds .size ()[:- 1 ]
359
- batch_size , seq_length = input_shape
360
358
else :
361
359
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
362
360
361
+ batch_size , seq_length = input_shape
363
362
device = input_ids .device if input_ids is not None else inputs_embeds .device
364
363
365
364
# past_key_values_length
Original file line number Diff line number Diff line change @@ -2024,13 +2024,12 @@ def forward(
2024
2024
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
2025
2025
elif input_ids is not None :
2026
2026
input_shape = input_ids .size ()
2027
- batch_size , seq_length = input_shape
2028
2027
elif inputs_embeds is not None :
2029
2028
input_shape = inputs_embeds .size ()[:- 1 ]
2030
- batch_size , seq_length = input_shape
2031
2029
else :
2032
2030
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
2033
2031
2032
+ batch_size , seq_length = input_shape
2034
2033
device = input_ids .device if input_ids is not None else inputs_embeds .device
2035
2034
2036
2035
# past_key_values_length
Original file line number Diff line number Diff line change @@ -1119,13 +1119,12 @@ def forward(
1119
1119
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
1120
1120
elif input_ids is not None :
1121
1121
input_shape = input_ids .size ()
1122
- batch_size , seq_length = input_shape
1123
1122
elif inputs_embeds is not None :
1124
1123
input_shape = inputs_embeds .size ()[:- 1 ]
1125
- batch_size , seq_length = input_shape
1126
1124
else :
1127
1125
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
1128
1126
1127
+ batch_size , seq_length = input_shape
1129
1128
device = input_ids .device if input_ids is not None else inputs_embeds .device
1130
1129
1131
1130
if attention_mask is None :
Original file line number Diff line number Diff line change @@ -803,13 +803,12 @@ def forward(
803
803
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
804
804
elif input_ids is not None :
805
805
input_shape = input_ids .size ()
806
- batch_size , seq_length = input_shape
807
806
elif inputs_embeds is not None :
808
807
input_shape = inputs_embeds .size ()[:- 1 ]
809
- batch_size , seq_length = input_shape
810
808
else :
811
809
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
812
810
811
+ batch_size , seq_length = input_shape
813
812
device = input_ids .device if input_ids is not None else inputs_embeds .device
814
813
815
814
if attention_mask is None :
Original file line number Diff line number Diff line change @@ -887,13 +887,12 @@ def forward(
887
887
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
888
888
elif input_ids is not None :
889
889
input_shape = input_ids .size ()
890
- batch_size , seq_length = input_shape
891
890
elif inputs_embeds is not None :
892
891
input_shape = inputs_embeds .size ()[:- 1 ]
893
- batch_size , seq_length = input_shape
894
892
else :
895
893
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
896
894
895
+ batch_size , seq_length = input_shape
897
896
device = input_ids .device if input_ids is not None else inputs_embeds .device
898
897
899
898
if attention_mask is None :
Original file line number Diff line number Diff line change @@ -924,13 +924,12 @@ def forward(
924
924
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
925
925
elif input_ids is not None :
926
926
input_shape = input_ids .size ()
927
- batch_size , seq_length = input_shape
928
927
elif inputs_embeds is not None :
929
928
input_shape = inputs_embeds .size ()[:- 1 ]
930
- batch_size , seq_length = input_shape
931
929
else :
932
930
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
933
931
932
+ batch_size , seq_length = input_shape
934
933
device = input_ids .device if input_ids is not None else inputs_embeds .device
935
934
936
935
# past_key_values_length
Original file line number Diff line number Diff line change @@ -829,13 +829,12 @@ def forward(
829
829
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
830
830
elif input_ids is not None :
831
831
input_shape = input_ids .size ()
832
- batch_size , seq_length = input_shape
833
832
elif inputs_embeds is not None :
834
833
input_shape = inputs_embeds .size ()[:- 1 ]
835
- batch_size , seq_length = input_shape
836
834
else :
837
835
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
838
836
837
+ batch_size , seq_length = input_shape
839
838
device = input_ids .device if input_ids is not None else inputs_embeds .device
840
839
841
840
# past_key_values_length
Original file line number Diff line number Diff line change @@ -789,13 +789,12 @@ def forward(
789
789
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
790
790
elif input_ids is not None :
791
791
input_shape = input_ids .size ()
792
- batch_size , seq_length = input_shape
793
792
elif inputs_embeds is not None :
794
793
input_shape = inputs_embeds .size ()[:- 1 ]
795
- batch_size , seq_length = input_shape
796
794
else :
797
795
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
798
796
797
+ batch_size , seq_length = input_shape
799
798
device = input_ids .device if input_ids is not None else inputs_embeds .device
800
799
801
800
# past_key_values_length
Original file line number Diff line number Diff line change @@ -888,13 +888,12 @@ def forward(
888
888
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
889
889
elif input_ids is not None :
890
890
input_shape = input_ids .size ()
891
- batch_size , seq_length = input_shape
892
891
elif inputs_embeds is not None :
893
892
input_shape = inputs_embeds .size ()[:- 1 ]
894
- batch_size , seq_length = input_shape
895
893
else :
896
894
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
897
895
896
+ batch_size , seq_length = input_shape
898
897
device = input_ids .device if input_ids is not None else inputs_embeds .device
899
898
900
899
# past_key_values_length
Original file line number Diff line number Diff line change @@ -683,13 +683,12 @@ def forward(
683
683
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
684
684
elif input_ids is not None :
685
685
input_shape = input_ids .size ()
686
- batch_size , seq_length = input_shape
687
686
elif inputs_embeds is not None :
688
687
input_shape = inputs_embeds .size ()[:- 1 ]
689
- batch_size , seq_length = input_shape
690
688
else :
691
689
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
692
690
691
+ batch_size , seq_length = input_shape
693
692
device = input_ids .device if input_ids is not None else inputs_embeds .device
694
693
695
694
# past_key_values_length
Original file line number Diff line number Diff line change @@ -767,10 +767,8 @@ def forward(
767
767
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
768
768
elif input_ids is not None :
769
769
input_shape = input_ids .size ()
770
- batch_size , seq_length = input_shape
771
770
elif inputs_embeds is not None :
772
771
input_shape = inputs_embeds .size ()[:- 1 ]
773
- batch_size , seq_length = input_shape
774
772
else :
775
773
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
776
774
@@ -779,6 +777,7 @@ def forward(
779
777
f"`visual_embeds` can not be of type { type (visual_embeds )} when using a VisualBert Model."
780
778
)
781
779
780
+ batch_size , seq_length = input_shape
782
781
device = input_ids .device if input_ids is not None else inputs_embeds .device
783
782
784
783
visual_input_shape = visual_embeds .size ()[:- 1 ]
Original file line number Diff line number Diff line change @@ -846,13 +846,12 @@ def forward(
846
846
raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
847
847
elif input_ids is not None :
848
848
input_shape = input_ids .size ()
849
- batch_size , seq_length = input_shape
850
849
elif inputs_embeds is not None :
851
850
input_shape = inputs_embeds .size ()[:- 1 ]
852
- batch_size , seq_length = input_shape
853
851
else :
854
852
raise ValueError ("You have to specify either input_ids or inputs_embeds" )
855
853
854
+ batch_size , seq_length = input_shape
856
855
device = input_ids .device if input_ids is not None else inputs_embeds .device
857
856
858
857
# past_key_values_length
You can’t perform that action at this time.
0 commit comments