facebookresearch / ParlAI

A framework for training and evaluating AI models on a variety of openly available dialogue datasets.
https://parl.ai
MIT License
10.49k stars 2.09k forks source link

AttributeError: 'BB3Retriever' object has no attribute 'search_queries' #4981

Closed sgowdaks closed 1 year ago

sgowdaks commented 1 year ago

Bug description Hi, I am new to ParlAI and when I am trying to run the command parlai interactive --model projects.bb3.agents.r2c2_bb3_agent:BB3SubSearchAgent --model-file zoo:bb3/bb3_3B/model --rag-retriever-type search_engine --search-server https://www.mojeek.com/

I am getting the following error: AttributeError: 'BB3Retriever' object has no attribute 'search_queries'

It runs fine without the search server, but with the search server I get the following error

Logs

22:51:32 | creating task(s): interactive
Enter Your Message: hola
Traceback (most recent call last):
  File "/home/sg/miniconda3/envs/chatbot/bin/parlai", line 8, in <module>
    sys.exit(main())
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/__main__.py", line 14, in main
    superscript_main()
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/core/script.py", line 325, in superscript_main
    return SCRIPT_REGISTRY[cmd].klass._run_from_parser_and_opt(opt, parser)
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/core/script.py", line 108, in _run_from_parser_and_opt
    return script.run()
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/scripts/interactive.py", line 118, in run
    return interactive(self.opt)
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/scripts/interactive.py", line 93, in interactive
    world.parley()
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/tasks/interactive/worlds.py", line 89, in parley
    acts[1] = agents[1].act()
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/core/torch_agent.py", line 2148, in act
    response = self.batch_act([self.observation])[0]
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/core/torch_agent.py", line 2244, in batch_act
    output = self.eval_step(batch)
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/projects/seeker/agents/seeker.py", line 160, in eval_step
    output = TorchGeneratorAgent.eval_step(self, batch)
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/core/torch_generator_agent.py", line 901, in eval_step
    beam_preds_scores, beams = self._generate(
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/agents/rag/rag.py", line 684, in _generate
    gen_outs = self._rag_generate(batch, beam_size, max_ts, prefix_tokens)
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/agents/rag/rag.py", line 727, in _rag_generate
    return self._generation_agent._generate(
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/core/torch_generator_agent.py", line 1163, in _generate
    encoder_states = model.encoder(*self._encoder_input(batch))
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/projects/seeker/agents/seeker_modules.py", line 244, in encoder
    output = super().encoder(
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/agents/fid/fid.py", line 149, in encoder
    enc_out, mask, input_turns_cnt, top_docs, top_doc_scores = super().encoder(
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/agents/rag/modules.py", line 192, in encoder
    expanded_input, top_docs, top_doc_scores = self.retrieve_and_concat(
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/agents/rag/modules.py", line 327, in retrieve_and_concat
    top_docs, top_doc_scores = self.retriever.retrieve(query_vec)
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/agents/rag/retrievers.py", line 419, in retrieve
    docs, scores = self.retrieve_and_score(query)
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/projects/bb3/agents/r2c2_bb3_agent.py", line 166, in retrieve_and_score
    return super().retrieve_and_score(query)
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/parlai/agents/rag/retrievers.py", line 1212, in retrieve_and_score
    search_queries = self.generate_search_query(query)
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/projects/seeker/agents/seeker_modules.py", line 130, in generate_search_query
    if self.search_queries:
  File "/home/sg/miniconda3/envs/chatbot/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1269, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'BB3Retriever' object has no attribute 'search_queries'

Thanks!

klshuster commented 1 year ago

you have the wrong agent specified -- you'll want to set --init-opt gen/r2c2_bb3

additionally, specifying just a website as your --search-server will not work. I would search around the issues in ParlAI to see how others have set up the search server

github-actions[bot] commented 1 year ago

This issue has not had activity in 30 days. Please feel free to reopen if you have more issues. You may apply the "never-stale" tag to prevent this from happening.