ParlAI icon indicating copy to clipboard operation
ParlAI copied to clipboard

Blenderbot 3 Import Error

Open shleeku opened this issue 3 years ago • 5 comments

Hi I am trying to run Blenderbot 3 on Ubuntu 20.04 tried with RTX 2080Ti and RTX 3080Ti and it worked exactly once (one turn) after which it keeps giving the same error. I'm in Korea so I'm wondering whether it's because you haven't released it internationally yet (but if so why did it work the first time?) and if so if you could let us know when you plan to release it would be greatly appreciated.

Used the following command in terminal (after setting up environment, installing requirements.txt, etc):

parlai interactive --model-file zoo:bb3/bb3_3B/model --init-opt gen/r2c2_bb3

Got the following error:

Traceback (most recent call last): File "/home/david/anaconda3/envs/parlai/lib/python3.8/site-packages/parlai/core/build_data.py", line 490, in modelzoo_path my_module = importlib.import_module(module_name) File "/home/david/anaconda3/envs/parlai/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 961, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'parlai.zoo.bb3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/david/anaconda3/envs/parlai/lib/python3.8/site-packages/parlai/core/build_data.py", line 497, in modelzoo_path my_module = importlib.import_module(module_name_) File "/home/david/anaconda3/envs/parlai/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 961, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'parlai.zoo.bb3'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/david/anaconda3/envs/parlai/bin/parlai", line 8, in sys.exit(main()) File "/home/david/anaconda3/envs/parlai/lib/python3.8/site-packages/parlai/main.py", line 14, in main superscript_main() File "/home/david/anaconda3/envs/parlai/lib/python3.8/site-packages/parlai/core/script.py", line 316, in superscript_main opt = parser.parse_args(args) File "/home/david/anaconda3/envs/parlai/lib/python3.8/site-packages/parlai/core/params.py", line 1163, in parse_args self.add_extra_args(args) File "/home/david/anaconda3/envs/parlai/lib/python3.8/site-packages/parlai/core/script.py", line 175, in add_extra_args sa.choices[args[0]].add_extra_args(args) File "/home/david/anaconda3/envs/parlai/lib/python3.8/site-packages/parlai/core/params.py", line 946, in add_extra_args model = get_model_name(parsed) File "/home/david/anaconda3/envs/parlai/lib/python3.8/site-packages/parlai/core/params.py", line 136, in get_model_name model_file = modelzoo_path(opt.get('datapath'), model_file) File "/home/david/anaconda3/envs/parlai/lib/python3.8/site-packages/parlai/core/build_data.py", line 501, in modelzoo_path raise ImportError( ImportError: Could not find pretrained model in parlai.zoo.bb3.bb3_3B or parlai.zoo.bb3.build. Please check your spelling and make sure you've pulled from master.

shleeku avatar Aug 10 '22 07:08 shleeku

I've got similar error:

Error
Traceback (most recent call last):
File "C:\Users\carro\Documents\Unity Projects\Tests\SeekerTest\Assets\Scripts\Blenderbot3\bb3.py", line 27, in <module>
  instance.run()
File "C:\Users\carro\Documents\Unity Projects\Tests\SeekerTest\Assets\Scripts\Blenderbot3\bb3.py", line 15, in run
  self.chatServiceRunner = ChatServiceRunner(mydir)
File "C:\Users\carro\Documents\Unity Projects\Tests\SeekerTest\Assets\Scripts\Blenderbot3\src\run.py", line 56, in __init__
  self.opt = self.setup_args()
File "C:\Users\carro\Documents\Unity Projects\Tests\SeekerTest\Assets\Scripts\Blenderbot3\src\run.py", line 35, in setup_args
  return parser.parse_args()
File "C:\Users\carro\Documents\Unity Projects\Tests\SeekerTest\Assets\StreamingAssets\python-3.8.10\parlai\core\params.py", line 1169, in parse_args
  self.add_extra_args(args)
File "C:\Users\carro\Documents\Unity Projects\Tests\SeekerTest\Assets\StreamingAssets\python-3.8.10\parlai\core\params.py", line 948, in add_extra_args
  self.add_model_subargs(model, partial)
File "C:\Users\carro\Documents\Unity Projects\Tests\SeekerTest\Assets\StreamingAssets\python-3.8.10\parlai\core\params.py", line 822, in add_model_subargs
  agent = load_agent_module(model)
File "C:\Users\carro\Documents\Unity Projects\Tests\SeekerTest\Assets\StreamingAssets\python-3.8.10\parlai\core\loader.py", line 188, in load_agent_module
  my_module = importlib.import_module(module_name)
File "importlib\__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'projects.bb3'

The code which I was running, is as follows (stripped down a bit):

Code
class ChatServiceRunner:

  def setup_args(self):
      """
      Set up args.
      :return: A parser that takes in command line arguments for chat services (debug, config-path, password), and a port.
      """
      parser = ParlaiParser(False, False)
      parser.add_argument('--datapath', default=self.dataPath)
      parser.add_argument('--download-path', default=self.downloadPath)
      parser.add_argument('--init-opt', default="gen/r2c2_bb3")

      parser_grp = parser.add_argument_group('Websockets')
      parser_grp.add_argument('--port', default=34500, type=int, help='Port to run the browser chat server')
      parser_grp.add_argument('--debug', dest='is_debug', action='store_true', help='print and log all server interactions and messages',)
      parser_grp.add_argument(
          '--password',
          dest='password',
          type=str,
          default=None,
          help='Require a password for entry to the bot',
      )

      return parser.parse_args()

  def __init__(self, _corePath):
      self.corePath = _corePath
      self.appPath = os.path.normpath(os.getcwd() + os.sep + os.pardir + os.sep + os.pardir) #selects parent dir two levels up
      self.dataPath = os.path.join(self.appPath, "ModelData")
      self.downloadPath = os.path.join(self.appPath, "Downloads")
      print(self.dataPath)
      self.opt = self.setup_args()

Any ideas what could be causing this?

I've installed ParlAI via zip download today, then running setup.py.

Darth-Carrotpie avatar Aug 11 '22 10:08 Darth-Carrotpie

Perhaps related to #4731 ?

Darth-Carrotpie avatar Aug 11 '22 14:08 Darth-Carrotpie

These commands should work if you have installed directly from source.

We have not made a formal pip release yet including BB3, but that is imminent.

klshuster avatar Aug 11 '22 17:08 klshuster

These commands should work if you have installed directly from source.

We have not made a formal pip release yet including BB3, but that is imminent.

Thanks Kurt, will try installing again

shleeku avatar Aug 12 '22 10:08 shleeku

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.

github-actions[bot] avatar Sep 18 '22 00:09 github-actions[bot]