class_docstr: Simple agent that counts the number of unique things it has seen.
  
  Could be simpler, but we make it a TorchAgent so it's happy with dynamic batching.
class_docstr_tok: ["Simple","agent","that","counts","the","number","of","unique","things","it","has","seen",".","Could","be","simpler",",","but","we","make","it","a","TorchAgent","so","it","'s","happy","with","dynamic","batching","."]
code: def __init__(self, opt, shared=None):
      self.model = self.build_model()
      self.criterion = None
      super().__init__(opt, shared)
      self._counter: Counter[Tuple[str, str]]
      if shared is None:
          self._counter = Counter()
          self._padding_counter = Counter()
      else:
          self._counter = shared["counter"]
          self._padding_counter = shared["padding"]
  
imports: from __future__ import annotations
  from typing import Tuple
  from collections import Counter
  from parlai.core.torch_agent import TorchAgent
  from parlai.core.metrics import Metric, SumMetric
  from parlai.core.message import Message
label_desc: Use image node_id 1 to create a new CounterAgent object from inherited base classes: TorchAgent with example: obj = CounterAgent(opt, shared)