class_docstr: Agent that uses a local model and tokenizer to generate code.
  
  Args:
      model ([`PreTrainedModel`]):
          The model to use for the agent.
      tokenizer ([`PreTrainedTokenizer`]):
          The tokenizer to use for the agent.
      chat_prompt_template (`str`, *optional*):
          Pass along your own prompt if you want to override the default template for the `chat` method. Can be the
          actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
          `chat_prompt_template.txt` in this repo in this case.
      run_prompt_template (`str`, *optional*):
          Pass along your own prompt if you want to override the default template for the `run` method. Can be the
          actual prompt template or a repo ID (on the Hugging Face Hub). The prompt should be in a file named
          `run_prompt_template.txt` in this repo in this case.
      additional_tools ([`Tool`], list of tools or dictionary with tool values, *optional*):
          Any additional tools to include on top of the default ones. If you pass along a tool with the same name as
          one of the default tools, that default tool will be overridden.
  
  Example:
  
  ```py
  import torch
  from transformers import AutoModelForCausalLM, AutoTokenizer, LocalAgent
  
  checkpoint = "bigcode/starcoder"
  model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
  tokenizer = AutoTokenizer.from_pretrained(checkpoint)
  
  agent = LocalAgent(model, tokenizer)
  agent.run("Draw me a picture of rivers and lakes.")
  ```
class_docstr_tok: ["Agent","that","uses","a","local","model","and","tokenizer","to","generate","code",".","Args",":","model","(","[","`","PreTrainedModel","`","]",")",":","The","model","to","use","for","the","agent",".","tokenizer","(","[","`","PreTrainedTokenizer","`","]",")",":","The","tokenizer","to","use","for","the","agent",".","chat_prompt_template","(","`","str","`",",","*","optional","*",")",":","Pass","along","your","own","prompt","if","you","want","to","override","the","default","template","for","the","`","chat","`","method",".","Can","be","the","actual","prompt","template","or","a","repo","ID","(","on","the","Hugging","Face","Hub",")",".","The","prompt","should","be","in","a","file","named","`","chat_prompt_template.txt","`","in","this","repo","in","this","case",".","run_prompt_template","(","`","str","`",",","*","optional","*",")",":","Pass","along","your","own","prompt","if","you","want","to","override","the","default","template","for","the","`","run","`","method",".","Can","be","the","actual","prompt","template","or","a","repo","ID","(","on","the","Hugging","Face","Hub",")",".","The","prompt","should","be","in","a","file","named","`","run_prompt_template.txt","`","in","this","repo","in","this","case",".","additional_tools","(","[","`","Tool","`","]",",","list","of","tools","or","dictionary","with","tool","values",",","*","optional","*",")",":","Any","additional","tools","to","include","on","top","of","the","default","ones",".","If","you","pass","along","a","tool","with","the","same","name","as","one","of","the","default","tools",",","that","default","tool","will","be","overridden",".","Example",":","``","`","py","import","torch","from","transformers","import","AutoModelForCausalLM",",","AutoTokenizer",",","LocalAgent","checkpoint","=","``","bigcode\/starcoder","''","model","=","AutoModelForCausalLM.from_pretrained","(","checkpoint",",","device_map=","''","auto","''",",","torch_dtype=torch.bfloat16",")","tokenizer","=","AutoTokenizer.from_pretrained","(","checkpoint",")","agent","=","LocalAgent","(","model",",","tokenizer",")","agent.run","(","``","Draw","me","a","picture","of","rivers","and","lakes",".","''",")","``","`"]
code: def _model_device(self):
      if hasattr(self.model, "hf_device_map"):
          return list(self.model.hf_device_map.values())[0]
      for param in self.model.parameters():
          return param.device
  
imports: import importlib.util
  import json
  import os
  import time
  from dataclasses import dataclass
  from typing import Dict
  import requests
  from huggingface_hub import HfFolder, hf_hub_download, list_spaces
  from ..models.auto import AutoTokenizer
  from ..utils import is_offline_mode, is_openai_available, is_torch_available, logging
  from .base import TASK_MAPPING, TOOL_CONFIG_FILE, Tool, load_tool, supports_remote
  from .prompts import CHAT_MESSAGE_PROMPT, download_prompt
  from .python_interpreter import evaluate
label_desc: Use image node_id 3 for calling the LocalAgent obj's underlying member method code with example usage: obj._model_device() and returns: list, param