Skip to content

Commit

Permalink
Merge pull request #208 from huggingface/adapt-agent-cookbooks-to-new…
Browse files Browse the repository at this point in the history
…-release

Adapt agent notebooks to new transformers release
  • Loading branch information
aymeric-roucher authored Sep 26, 2024
2 parents 668cce2 + 630996d commit ad278fa
Show file tree
Hide file tree
Showing 5 changed files with 587 additions and 1,075 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 ad278fa

Please sign in to comment.