question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Runtime error from "minimal start" script

See original GitHub issue

Hello,

I’m attempting to run the minimal start example on https://simpletransformers.ai/docs/multi-class-classification/, modified to be CPU-only:

# Create a ClassificationModel
model = ClassificationModel( "bert", "bert-base-cased", num_labels=3, args=model_args, use_cuda=False )

I installed simple transformers as described here https://simpletransformers.ai/docs/installation/, opting for the CPU-only installation (which means I did not install “Apex”).

Running this, I get thousands of the following section logged to console. It does not exit, but I have haad it running for ~half an hour now and it just keeps on emitting the following errors:

INFO:simpletransformers.classification.classification_model: Converting to features started. Cache is not used.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/spawn.py", line 125, in _main
    prepare(preparation_data)
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/runpy.py", line 263, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/jkearl/Desktop/test.py", line 39, in <module>
    model.train_model(train_df)
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/site-packages/simpletransformers/classification/classification_model.py", line 258, in train_model
    train_dataset = self.load_and_cache_examples(train_examples, verbose=verbose)
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/site-packages/simpletransformers/classification/classification_model.py", line 803, in load_and_cache_examples
    features = convert_examples_to_features(
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/site-packages/simpletransformers/classification/classification_utils.py", line 364, in convert_examples_to_features
    with Pool(process_count) as p:
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/pool.py", line 212, in __init__
    self._repopulate_pool()
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/pool.py", line 303, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/pool.py", line 326, in _repopulate_pool_static
    w.start()
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/context.py", line 283, in _Popen
    return Popen(process_obj)
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/Users/jkearl/anaconda3/envs/transformers/lib/python3.8/multiprocessing/spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
RuntimeError: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

I’m on macOS Moajve, running with latest anaconda.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
JacksonKearlcommented, May 13, 2020
conda install python=3.7
pip install simpletransformers

fixed it, thanks.

1reaction
OnePunchManncommented, Nov 18, 2020

check model_args.py u need to set dataloader_num_workers: int = 0

Read more comments on GitHub >

github_iconTop Results From Across the Web

runtime error in setup script - Microsoft Community
A runtime error is a software or hardware problem that prevents a program from working correctly. Runtime errors might cause you to lose...
Read more >
Runtime Error: What It Is and How to Fix It - Lifewire
A runtime error occurs while a program is running or when you first attempt to start the application. The error sometimes goes away...
Read more >
Runtime Errors - GeeksforGeeks
Runtime Errors : A runtime error in a program is an error that occurs while the program is running after being successfully compiled....
Read more >
LSL Errors - Second Life Wiki
Script run-time error: Stack-Heap Collision ... In LSO each script runs inside 16 KiB of memory divided out among Bytecode, Stack, and Heap....
Read more >
"Scripting error or runtime error" - Brother
4. Disable script and runtime errors (See Figure Below) ; Start, click ; Control Panel, and then ; double-click Internet Options.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found