File tree Expand file tree Collapse file tree 5 files changed +29
-10
lines changed
Expand file tree Collapse file tree 5 files changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,9 @@ def _load(self):
146146 import_user_module (argparse .Namespace (user_dir = self ._user_dir ))
147147
148148 with torch .no_grad ():
149- checkpoint = checkpoint_utils .load_checkpoint_to_cpu (self ._model_path )
149+ checkpoint = torch .load (
150+ self ._model_path , map_location = torch .device ("cpu" ), weights_only = False
151+ )
150152 args = checkpoint ["args" ] or checkpoint ["cfg" ]["model" ]
151153
152154 args .data = self ._data_dir
Original file line number Diff line number Diff line change @@ -174,7 +174,9 @@ def __init__(self, model_path: str):
174174 def _load (self ):
175175 import torch
176176
177- checkpoint = torch .load (self ._model_path , map_location = "cpu" )
177+ checkpoint = torch .load (
178+ self ._model_path , map_location = "cpu" , weights_only = False
179+ )
178180
179181 src_vocabs , tgt_vocabs = get_vocabs (checkpoint ["vocab" ])
180182
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ def __init__(
109109 quant_type : Optional [common_spec .Quantization ] = None ,
110110 quant_group_size : Optional [int ] = None ,
111111 quant_bits : Optional [int ] = None ,
112- qk_norm : Optional [ bool ] = False ,
112+ qk_norm : bool = False ,
113113 ):
114114 """Initializes a Transformer decoder specification.
115115
@@ -562,7 +562,7 @@ def from_config(
562562 quant_type : Optional [common_spec .Quantization ] = None ,
563563 quant_group_size : Optional [int ] = None ,
564564 quant_bits : Optional [int ] = None ,
565- qk_norm : Optional [ bool ] = False ,
565+ qk_norm : bool = False ,
566566 ):
567567 """Creates a Transformer decoder model specification.
568568
Original file line number Diff line number Diff line change 1- transformers == 4.41 .* ;platform_system == 'Linux'
2- fairseq == 0.12.2 ; platform_system == 'Linux ' or platform_system== 'Darwin '
3- OpenNMT-py == 2.2.* ;platform_system == 'Linux ' or platform_system =='Darwin '
1+ transformers == 4.57 .* ;platform_system == 'Linux'
2+ git+https://github.com/facebookresearch/ fairseq.git@main; sys_platform == 'linux ' or sys_platform == 'darwin '
3+ OpenNMT-py == 2.2.* ;sys_platform == 'linux ' or sys_platform =='darwin '
44pytest
5- wurlitzer == 3.0.* ;platform_system == 'Linux '
6- torch == 2.4.1
5+ wurlitzer == 3.0.* ;sys_platform == 'linux '
6+ torch == 2.6
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def clear_transformers_cache_in_ci():
2121 import transformers
2222
2323 if os .environ .get ("CI" ) == "true" :
24- shutil .rmtree (transformers .utils .default_cache_path )
24+ shutil .rmtree (transformers .utils .default_cache_path , ignore_errors = True )
2525
2626
2727_TRANSFORMERS_TRANSLATION_TESTS = [
@@ -194,6 +194,21 @@ def test_transformers_translation(
194194 "Hello , ĠI Ġam Ġa Ġnew bie Ġin Ġthe Ġworld Ġof Ġweb Ġdesign Ġand ĠI Ġam "
195195 "Ġlooking Ġfor Ġa Ġweb Ġdeveloper" ,
196196 ),
197+ (
198+ "jordimas/gemma-3-1b-it" ,
199+ "<bos> Which ▁city ▁hosted ▁the ▁Olympic ▁Games ▁in ▁ 1 9 9 2 ?" ,
200+ 50 ,
201+ "Which ▁city ▁hosted ▁the ▁Olympic ▁Games ▁in ▁ 1 9 9 2 ? \n \n "
202+ " The ▁answer ▁is ▁** Barcelona **. \n " ,
203+ ),
204+ (
205+ "Qwen/Qwen3-0.6B" ,
206+ "<|im_start|> user Ċ What Ġis Ġthe Ġcapital Ġof ĠPortugal ? Ġ/ no _th ink Ċ <|im_end|> Ċ "
207+ "<|im_start|> assistant Ċ" ,
208+ 50 ,
209+ "<|im_start|> user Ċ What Ġis Ġthe Ġcapital Ġof ĠPortugal ? Ġ/ no _th ink Ċ <|im_end|> Ċ "
210+ "<|im_start|> assistant Ċ <think> ĊĊ </think> ĊĊ The Ġcapital Ġof ĠPortugal Ġis ĠLisbon ." ,
211+ ),
197212]
198213
199214
You can’t perform that action at this time.
0 commit comments