File tree Expand file tree Collapse file tree
templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}} Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -693,12 +693,12 @@ def forward(
693693 raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
694694 elif input_ids is not None :
695695 input_shape = input_ids .size ()
696- batch_size , seq_length = input_shape
697696 elif inputs_embeds is not None :
698697 input_shape = inputs_embeds .size ()[:- 1 ]
699698 else :
700699 raise ValueError ("You have to specify either input_ids or inputs_embeds" )
701700
701+ batch_size , seq_length = input_shape
702702 device = input_ids .device if input_ids is not None else inputs_embeds .device
703703
704704 if attention_mask is None :
Original file line number Diff line number Diff line change @@ -936,13 +936,12 @@ def forward(
936936 raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
937937 elif input_ids is not None :
938938 input_shape = input_ids .size ()
939- batch_size , seq_length = input_shape
940939 elif inputs_embeds is not None :
941940 input_shape = inputs_embeds .size ()[:- 1 ]
942- batch_size , seq_length = input_shape
943941 else :
944942 raise ValueError ("You have to specify either input_ids or inputs_embeds" )
945943
944+ batch_size , seq_length = input_shape
946945 device = input_ids .device if input_ids is not None else inputs_embeds .device
947946
948947 # past_key_values_length
Original file line number Diff line number Diff line change @@ -353,13 +353,12 @@ def forward(
353353 raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
354354 elif input_ids is not None :
355355 input_shape = input_ids .size ()
356- batch_size , seq_length = input_shape
357356 elif inputs_embeds is not None :
358357 input_shape = inputs_embeds .size ()[:- 1 ]
359- batch_size , seq_length = input_shape
360358 else :
361359 raise ValueError ("You have to specify either input_ids or inputs_embeds" )
362360
361+ batch_size , seq_length = input_shape
363362 device = input_ids .device if input_ids is not None else inputs_embeds .device
364363
365364 # past_key_values_length
Original file line number Diff line number Diff line change @@ -2024,13 +2024,12 @@ def forward(
20242024 raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
20252025 elif input_ids is not None :
20262026 input_shape = input_ids .size ()
2027- batch_size , seq_length = input_shape
20282027 elif inputs_embeds is not None :
20292028 input_shape = inputs_embeds .size ()[:- 1 ]
2030- batch_size , seq_length = input_shape
20312029 else :
20322030 raise ValueError ("You have to specify either input_ids or inputs_embeds" )
20332031
2032+ batch_size , seq_length = input_shape
20342033 device = input_ids .device if input_ids is not None else inputs_embeds .device
20352034
20362035 # past_key_values_length
Original file line number Diff line number Diff line change @@ -1119,13 +1119,12 @@ def forward(
11191119 raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
11201120 elif input_ids is not None :
11211121 input_shape = input_ids .size ()
1122- batch_size , seq_length = input_shape
11231122 elif inputs_embeds is not None :
11241123 input_shape = inputs_embeds .size ()[:- 1 ]
1125- batch_size , seq_length = input_shape
11261124 else :
11271125 raise ValueError ("You have to specify either input_ids or inputs_embeds" )
11281126
1127+ batch_size , seq_length = input_shape
11291128 device = input_ids .device if input_ids is not None else inputs_embeds .device
11301129
11311130 if attention_mask is None :
Original file line number Diff line number Diff line change @@ -803,13 +803,12 @@ def forward(
803803 raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
804804 elif input_ids is not None :
805805 input_shape = input_ids .size ()
806- batch_size , seq_length = input_shape
807806 elif inputs_embeds is not None :
808807 input_shape = inputs_embeds .size ()[:- 1 ]
809- batch_size , seq_length = input_shape
810808 else :
811809 raise ValueError ("You have to specify either input_ids or inputs_embeds" )
812810
811+ batch_size , seq_length = input_shape
813812 device = input_ids .device if input_ids is not None else inputs_embeds .device
814813
815814 if attention_mask is None :
Original file line number Diff line number Diff line change @@ -887,13 +887,12 @@ def forward(
887887 raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
888888 elif input_ids is not None :
889889 input_shape = input_ids .size ()
890- batch_size , seq_length = input_shape
891890 elif inputs_embeds is not None :
892891 input_shape = inputs_embeds .size ()[:- 1 ]
893- batch_size , seq_length = input_shape
894892 else :
895893 raise ValueError ("You have to specify either input_ids or inputs_embeds" )
896894
895+ batch_size , seq_length = input_shape
897896 device = input_ids .device if input_ids is not None else inputs_embeds .device
898897
899898 if attention_mask is None :
Original file line number Diff line number Diff line change @@ -924,13 +924,12 @@ def forward(
924924 raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
925925 elif input_ids is not None :
926926 input_shape = input_ids .size ()
927- batch_size , seq_length = input_shape
928927 elif inputs_embeds is not None :
929928 input_shape = inputs_embeds .size ()[:- 1 ]
930- batch_size , seq_length = input_shape
931929 else :
932930 raise ValueError ("You have to specify either input_ids or inputs_embeds" )
933931
932+ batch_size , seq_length = input_shape
934933 device = input_ids .device if input_ids is not None else inputs_embeds .device
935934
936935 # past_key_values_length
Original file line number Diff line number Diff line change @@ -829,13 +829,12 @@ def forward(
829829 raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
830830 elif input_ids is not None :
831831 input_shape = input_ids .size ()
832- batch_size , seq_length = input_shape
833832 elif inputs_embeds is not None :
834833 input_shape = inputs_embeds .size ()[:- 1 ]
835- batch_size , seq_length = input_shape
836834 else :
837835 raise ValueError ("You have to specify either input_ids or inputs_embeds" )
838836
837+ batch_size , seq_length = input_shape
839838 device = input_ids .device if input_ids is not None else inputs_embeds .device
840839
841840 # past_key_values_length
Original file line number Diff line number Diff line change @@ -789,13 +789,12 @@ def forward(
789789 raise ValueError ("You cannot specify both input_ids and inputs_embeds at the same time" )
790790 elif input_ids is not None :
791791 input_shape = input_ids .size ()
792- batch_size , seq_length = input_shape
793792 elif inputs_embeds is not None :
794793 input_shape = inputs_embeds .size ()[:- 1 ]
795- batch_size , seq_length = input_shape
796794 else :
797795 raise ValueError ("You have to specify either input_ids or inputs_embeds" )
798796
797+ batch_size , seq_length = input_shape
799798 device = input_ids .device if input_ids is not None else inputs_embeds .device
800799
801800 # past_key_values_length
You can’t perform that action at this time.
0 commit comments