class_docstr: Represents an adapter setup of a model including active adapters and active heads. This class is intended to be
  used as a context manager using the ``with`` statement. The setup defined by the ``AdapterSetup`` context will
  override static adapter setups defined in a model (i.e. setups specified via ``active_adapters``).
  
  Example::
  
      with AdapterSetup(Stack("a", "b")):
          # will use the adapter stack "a" and "b" outputs = model(**inputs)
  
  Note that the context manager is thread-local, i.e. it can be used with different setups in a multi-threaded
  environment.
class_docstr_tok: ["Represents","an","adapter","setup","of","a","model","including","active","adapters","and","active","heads",".","This","class","is","intended","to","be","used","as","a","context","manager","using","the","``","with","``","statement",".","The","setup","defined","by","the","``","AdapterSetup","``","context","will","override","static","adapter","setups","defined","in","a","model","(","i.e",".","setups","specified","via","``","active_adapters","``",")",".","Example",":",":","with","AdapterSetup","(","Stack","(","``","a","''",",","``","b","''",")",")",":","#","will","use","the","adapter","stack","``","a","''","and","``","b","''","outputs","=","model","(","*","*","inputs",")","Note","that","the","context","manager","is","thread-local",",","i.e",".","it","can","be","used","with","different","setups","in","a","multi-threaded","environment","."]
code: def __init__(
      self, adapter_setup, head_setup=None, ignore_empty: bool = False
  ):
      self.adapter_setup = parse_composition(adapter_setup)
      if head_setup:
          self.head_setup = head_setup
      else:
          self.head_setup = parse_heads_from_composition(
              self.adapter_setup
          )
      self._empty = (
          ignore_empty
          and self.adapter_setup is None
          and self.head_setup is None
      )
  
file_path: adapters/src/adapters/context.py
imports: import functools
  import threading
  from .composition import parse_composition, parse_heads_from_composition
label_desc: Use image node_id 1 to create a new AdapterSetup object  with example: obj = AdapterSetup(adapter_setup, head_setup, ignore_empty)