vsanchezn commited on
Commit
d7b8ac5
·
verified ·
1 Parent(s): c793910

using transformer model

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -1,4 +1,5 @@
1
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
 
2
  import datetime
3
  import requests
4
  import pytz
@@ -97,9 +98,15 @@ final_answer = FinalAnswerTool()
97
  # model_id='https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud',# it is possible that this model may be overloaded
98
  # custom_role_conversions=None,
99
  # )
100
- model = LiteLLMModel(
101
- model_id="ollama/qwen2.5-coder:32b"
102
- )
 
 
 
 
 
 
103
 
104
  # # Import tool from Hub
105
  # image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
@@ -108,7 +115,7 @@ with open("prompts.yaml", 'r') as stream:
108
  prompt_templates = yaml.safe_load(stream)
109
 
110
  agent = CodeAgent(
111
- model=model,
112
  tools=[
113
  final_answer,
114
  get_current_time_in_timezone,
 
1
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
2
+ from smolagents.models import TransformersModel
3
  import datetime
4
  import requests
5
  import pytz
 
98
  # model_id='https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud',# it is possible that this model may be overloaded
99
  # custom_role_conversions=None,
100
  # )
101
+
102
+ engine = TransformersModel(
103
+ model_id="meta-llama/Llama-3.2-3B-Instruct",
104
+ device_map="cuda", # or "cpu" if you don't have a GPU
105
+ trust_remote_code=True, # if your model requires remote code execution
106
+ torch_dtype='auto',
107
+ max_new_tokens=5000,
108
+ temperature=0.5
109
+ )
110
 
111
  # # Import tool from Hub
112
  # image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
 
115
  prompt_templates = yaml.safe_load(stream)
116
 
117
  agent = CodeAgent(
118
+ model=engine,
119
  tools=[
120
  final_answer,
121
  get_current_time_in_timezone,