@@ -30,33 +30,43 @@ def test_initialize_agent_transformers_device_map_configuration(mocker):
3030
3131
3232def test_initialize_agent_transformers_trust_remote_code_detection (mocker ):
33- """Test automatic trust_remote_code detection for Qwen, Phi, and StarCoder models."""
33+ """Test trust_remote_code=True is enabled for all transformers models.
34+
35+ Since v0.0.12, trust_remote_code is enabled by default for ALL models
36+ to support HuggingFace models with custom architectures.
37+ """
3438 from smoltrace .core import initialize_agent
3539
3640 mock_transformers_model = mocker .patch ("smolagents.TransformersModel" )
3741 mocker .patch ("smoltrace.core.ToolCallingAgent" )
3842
39- # Test Qwen model
43+ # Test Qwen model - should have trust_remote_code=True
4044 initialize_agent ("Qwen/Qwen2-7B-Instruct" , "tool" , provider = "transformers" )
4145 assert mock_transformers_model .call_args [1 ]["trust_remote_code" ] is True
4246
4347 mock_transformers_model .reset_mock ()
4448
45- # Test Phi model
49+ # Test Phi model - should have trust_remote_code=True
4650 initialize_agent ("microsoft/phi-2" , "tool" , provider = "transformers" )
4751 assert mock_transformers_model .call_args [1 ]["trust_remote_code" ] is True
4852
4953 mock_transformers_model .reset_mock ()
5054
51- # Test StarCoder model
55+ # Test StarCoder model - should have trust_remote_code=True
5256 initialize_agent ("bigcode/starcoder" , "tool" , provider = "transformers" )
5357 assert mock_transformers_model .call_args [1 ]["trust_remote_code" ] is True
5458
5559 mock_transformers_model .reset_mock ()
5660
57- # Test regular model ( should be False )
61+ # Test Llama model - should ALSO have trust_remote_code=True (changed in v0.0.12 )
5862 initialize_agent ("meta-llama/Llama-3.1-8B" , "tool" , provider = "transformers" )
59- assert mock_transformers_model .call_args [1 ]["trust_remote_code" ] is False
63+ assert mock_transformers_model .call_args [1 ]["trust_remote_code" ] is True
64+
65+ mock_transformers_model .reset_mock ()
66+
67+ # Test custom model (e.g., arcee-ai) - should have trust_remote_code=True
68+ initialize_agent ("arcee-ai/Trinity-Nano-Base" , "tool" , provider = "transformers" )
69+ assert mock_transformers_model .call_args [1 ]["trust_remote_code" ] is True
6070
6171
6272@pytest .mark .skip (reason = "Transformers not installed - requires GPU hardware" )
0 commit comments