graph4ai/graph4nlp

ValueError: Number of processes must be at least 1

ell-hol opened this issue ยท 2 comments

๐Ÿ› Bug

Sudden "ValueError: Number of processes must be at least 1" when running the summarization example

To Reproduce

Steps to reproduce the behavior:

  1. In the stanford coreNLP directory downloaded :
    java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000
  2. In root of repo:
    python examples/pytorch/summarization/cnn/main.py -g2s_config examples/pytorch/summarization/cnn/config/gcn_bisep.yaml -task_config examples/pytorch/summarization/cnn/config/cnn.yaml

The Error

Traceback (most recent call last):
File "examples/pytorch/summarization/cnn/main.py", line 492, in
main(g2s_template)
File "examples/pytorch/summarization/cnn/main.py", line 460, in main
runner = ModelHandler(config)
File "examples/pytorch/summarization/cnn/main.py", line 120, in init
self._build_dataloader()
File "examples/pytorch/summarization/cnn/main.py", line 151, in _build_dataloader
tokenizer=None,
File "/opt/conda/lib/python3.7/site-packages/graph4nlp_cu110-0.5.5-py3.7.egg/graph4nlp/pytorch/datasets/cnn.py", line 63, in init
**kwargs
File "/opt/conda/lib/python3.7/site-packages/graph4nlp_cu110-0.5.5-py3.7.egg/graph4nlp/pytorch/data/dataset.py", line 933, in init
**kwargs,
File "/opt/conda/lib/python3.7/site-packages/graph4nlp_cu110-0.5.5-py3.7.egg/graph4nlp/pytorch/data/dataset.py", line 414, in init
self._process()
File "/opt/conda/lib/python3.7/site-packages/graph4nlp_cu110-0.5.5-py3.7.egg/graph4nlp/pytorch/data/dataset.py", line 809, in _process
self.val = self.build_topology(self.val)
File "/opt/conda/lib/python3.7/site-packages/graph4nlp_cu110-0.5.5-py3.7.egg/graph4nlp/pytorch/data/dataset.py", line 703, in build_topology
pool = Pool(thread_number)
File "/opt/conda/lib/python3.7/multiprocessing/context.py", line 119, in Pool
context=self.get_context())
File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 169, in init
raise ValueError("Number of processes must be at least 1")
ValueError: Number of processes must be at least 1

Environment

  • Anaconda environment
  • graph4nlp-cu110 == 0.5.5
  • Pytorch 1.11.0
  • OS (e.g., Linux): Ubuntu 20.04
  • How you installed Graph4NLP (pip, source):
  • Build command you used (if compiling from source):
  • Python version: 3.7.12 (Anaconda)
  • Tesla V100 with CUDA 11.3

I guess you set "thread_number" to 0 in gcn_bisep.yaml. You can set it to a number greater than 0 and less than the number of cpu threads. For example, you can use grep 'processor' /proc/cpuinfo | sort -u | wc -l on Linux to check the number of cpu threads.

This issue will be closed. Feel free to reopen it if needed.