Skip to content

Commit

Permalink
Adapt agent notebooks to new transformers release
Browse files Browse the repository at this point in the history
  • Loading branch information
aymeric-roucher committed Sep 26, 2024
1 parent 0d84cc2 commit 718979e
Show file tree
Hide file tree
Showing 5 changed files with 587 additions and 1,073 deletions.
12 changes: 6 additions & 6 deletions notebooks/en/agent_change_llm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install -q openai anthropic"
"!pip install openai anthropic \"transformers[agents]\" --upgrade -q"
]
},
{
Expand Down Expand Up @@ -104,12 +104,12 @@
}
],
"source": [
"from transformers.agents import HfEngine, ReactCodeAgent\n",
"from transformers.agents import HfApiEngine, ReactCodeAgent\n",
"\n",
"repo_id = \"meta-llama/Meta-Llama-3-8B-Instruct\"\n",
"repo_id = \"meta-llama/Meta-Llama-3.1-8B-Instruct\"\n",
"endpoint_url = \"your_endpoint_url\"\n",
"\n",
"llm_engine = HfEngine(model=repo_id) # you could use model=endpoint_url here\n",
"llm_engine = HfApiEngine(model=repo_id) # you could use model=endpoint_url here\n",
"\n",
"agent = ReactCodeAgent(tools=[], llm_engine=llm_engine)\n",
"\n",
Expand Down Expand Up @@ -147,8 +147,8 @@
"}\n",
"\n",
"\n",
"class HfEngine:\n",
" def __init__(self, model: str = \"meta-llama/Meta-Llama-3-8B-Instruct\"):\n",
"class HfApiEngine:\n",
" def __init__(self, model: str = \"meta-llama/Meta-Llama-3.1-8B-Instruct\"):\n",
" self.model = model\n",
" self.client = InferenceClient(model=self.model, timeout=120)\n",
"\n",
Expand Down
Loading

0 comments on commit 718979e

Please sign in to comment.