Esempio n. 1
0
 def _get_shared_models(self, args: "DictConfig") -> Dict[str, dict]:
     _ = args  # Not needed
     models_needed = list(self.conversations_needed.keys())
     active_models = [
         m for m in models_needed if self.conversations_needed[m] > 0
     ]
     return TurkLikeAgent.get_bot_agents(args=args,
                                         active_models=active_models)
Esempio n. 2
0
 def _get_shared_models(self, args: "DictConfig") -> Dict[str, dict]:
     with open(args.blueprint.model_opt_path) as f:
         all_model_opts = yaml.safe_load(f.read())
     active_model_opts = {
         model: opt
         for model, opt in all_model_opts.items()
         if self.conversations_needed[model] > 0
     }
     return TurkLikeAgent.get_bot_agents(args=args,
                                         model_opts=active_model_opts)
Esempio n. 3
0
def get_bot_worker(opt: Dict[str, Any], model_name: str) -> TurkLikeAgent:
    """
    Return a bot agent.

    Agent behaves like a crowdsource worker but actually wraps around a dialogue model.
    """
    semaphore = opt['semaphore']
    shared_bot_agents = opt['shared_bot_agents']
    num_turns = opt['num_turns']
    bot_agent = create_agent_from_shared(shared_bot_agents[model_name])
    bot_worker = TurkLikeAgent(
        opt,
        model_name=model_name,
        model_agent=bot_agent,
        num_turns=num_turns,
        semaphore=semaphore,
    )
    return bot_worker
Esempio n. 4
0
 def _get_shared_models(self, args: "DictConfig") -> Dict[str, dict]:
     with open(args.blueprint.model_opt_path) as f:
         model_opts = yaml.safe_load(f.read())
     return TurkLikeAgent.get_bot_agents(args=args, model_opts=model_opts)