<i id='ElsNY'><tr id='ElsNY'><dt id='ElsNY'><q id='ElsNY'><span id='ElsNY'><b id='ElsNY'><form id='ElsNY'><ins id='ElsNY'></ins><ul id='ElsNY'></ul><sub id='ElsNY'></sub></form><legend id='ElsNY'></legend><bdo id='ElsNY'><pre id='ElsNY'><center id='ElsNY'></center></pre></bdo></b><th id='ElsNY'></th></span></q></dt></tr></i><div id='ElsNY'><tfoot id='ElsNY'></tfoot><dl id='ElsNY'><fieldset id='ElsNY'></fieldset></dl></div>
          <bdo id='ElsNY'></bdo><ul id='ElsNY'></ul>
        <legend id='ElsNY'><style id='ElsNY'><dir id='ElsNY'><q id='ElsNY'></q></dir></style></legend>
        <tfoot id='ElsNY'></tfoot>

        <small id='ElsNY'></small><noframes id='ElsNY'>

      1. 如何修复/调试 scikit learn 中引发的这个多进程终

        时间:2023-05-25

          <tbody id='jjMs3'></tbody>
        • <bdo id='jjMs3'></bdo><ul id='jjMs3'></ul>

            <tfoot id='jjMs3'></tfoot>

            • <legend id='jjMs3'><style id='jjMs3'><dir id='jjMs3'><q id='jjMs3'></q></dir></style></legend>
            • <i id='jjMs3'><tr id='jjMs3'><dt id='jjMs3'><q id='jjMs3'><span id='jjMs3'><b id='jjMs3'><form id='jjMs3'><ins id='jjMs3'></ins><ul id='jjMs3'></ul><sub id='jjMs3'></sub></form><legend id='jjMs3'></legend><bdo id='jjMs3'><pre id='jjMs3'><center id='jjMs3'></center></pre></bdo></b><th id='jjMs3'></th></span></q></dt></tr></i><div id='jjMs3'><tfoot id='jjMs3'></tfoot><dl id='jjMs3'><fieldset id='jjMs3'></fieldset></dl></div>

                  <small id='jjMs3'></small><noframes id='jjMs3'>

                  本文介绍了如何修复/调试 scikit learn 中引发的这个多进程终止工作错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我最近设置了一台新机器,以帮助减少拟合模型和数据处理的运行时间.

                  I recently set up a new machine to aid in decreasing run times for fitting models and data wrangling.

                  我做了一些初步的基准测试,一切都很顺利,但是当我尝试在 scikit learn 中启用多进程工作者时遇到了障碍.

                  I did some preliminary benchmarks and everything is mostly smoothe, but I ran into a snag when I tried enabling multi-process workers with in scikit learn.

                  我已将错误简化为与我的原始代码无关,因为我在不同的机器和 VM 上启用了此功能而没有问题.

                  I've simplified the error to not be associated with my original code as I enabled this feature without a problem on a different machine and a VM.

                  我还进行了内存分配检查,以确保我的机器没有用完可用的 RAM.我有 16gb 的 RAM,所以应该没有问题,但我留下了测试的输出,以防我错过了一些东西.

                  I've also done memory allocation checks to make sure my machine wasn't running out of available RAM. I have 16gb of RAM so there should be no issue, but I've left the output of the test incase I missed something.

                  鉴于附近的回溯错误,我可以告诉我的操作系统正在杀死它,但对于我的生活,我无法弄清楚为什么.据我所知,我的代码仅在仅使用单个 CPU 内核时才会运行.

                  Given the traceback error near I can tell my OS is killing this, but for the life of me I can't figure out why. Near as I can tell my code will ONLY run when it is just using a single CPU core.

                  我运行的是 Windows 10、AMD ryzen 7 2700x、16GB RAM

                  I'm running Windows 10, AMD ryzen 7 2700x, 16GB RAM

                  import sklearn
                  import numpy as np
                  import tracemalloc
                  import time
                  
                  
                  from sklearn.model_selection import cross_val_score
                  from numpy.random import randn
                  from sklearn.linear_model import Ridge
                  
                  
                  ##################### memory allocation snapshot
                  
                  tracemalloc.start()
                  
                  start_time = time.time()
                  snapshot1 = tracemalloc.take_snapshot()
                  
                  ###################### model
                  
                  X = randn(815000, 100)
                  y = randn(815000, 1)
                  mod = Ridge()
                  sc = cross_val_score(mod, X, y,verbose =10, n_jobs=3)
                  
                  ################### Second memory allocation snapshot
                  
                  snapshot2 = tracemalloc.take_snapshot()
                  top_stats = snapshot2.compare_to(snapshot1, 'lineno')
                  
                  print("[ Top 10 ]")
                  for stat in top_stats[:5]:
                  print(stat)
                  

                  由此得出的预期结果非常明显,只是拟合模型的返回分数.

                  The expected results from this are pretty obvious, just a returned score with the fit model.

                  [Parallel(n_jobs=3)]: Using backend LokyBackend with 3 concurrent workers.
                  [Parallel(n_jobs=3)]: Done   3 out of   3 | elapsed:    0.2s remaining:    0.0s
                  ---------------------------------------------------------------------------
                  TerminatedWorkerError                     Traceback (most recent call last)
                  <ipython-input-18-b2bdfd425f82> in <module>
                       16 y = randn(815000, 1)
                       17 mod = Ridge()
                  ---> 18 sc = cross_val_score(mod, X, y,verbose =10, n_jobs=3)
                  
                  ..........
                  
                  TerminatedWorkerError: A worker process managed by the executor was unexpectedly terminated. 
                  This could be caused by a segmentation fault while calling the function or by an excessive memory usage causing the Operating System to kill the worker.
                  

                  内存输出

                  [ Top 5 ]
                  <ipython-input-18-b2bdfd425f82>:15: size=622 MiB (+622 MiB), count=3 (+3), average=207 MiB
                  <ipython-input-18-b2bdfd425f82>:16: size=6367 KiB (+6367 KiB), count=3 (+3), average=2122 KiB
                  ~python37libinspect.py:732: size=37.2 KiB (+26.2 KiB), count=596 (+419), average=64 B
                  ~python37libsite-packagessklearnexternalsjoblib
                  umpy_pickle.py:292: size=7072 B (+3808 B), count=13 (+7), average=544 B
                  ~python37libpickle.py:549: size=5728 B (+3408 B), count=14 (+8), average=409 B
                  

                  推荐答案

                  我发现我的 scipy 模块与我的 windows 10 C++ 可再发行版本不兼容.

                  I figured out the my scipy module was incompatible with my windows 10 C++ redistributable version.

                  我所做的只是下载最新的 Visual Studio 并安装单个组件"部分中列出的 C++ 可再发行更新.

                  All i did was download the latest visual studio and installed the C++ redistributable update that is listed in the "individual components" section.

                  安装后,我重新启动计算机并运行.

                  Once I installed that I restarted my computer and ran.

                  import scipy
                  scipy.test()
                  

                  一旦它实际运行,我尝试了上面的代码块并修复了它.

                  Once that was actually running I attempted my code block above and it fixed.

                  我认为这归结为使用全新版本的 python 和 scipy 安装旧版本的 windows 10

                  I think what this boils down to is installing an old build of windows 10 with a brand new version of python and scipy

                  这需要很长时间来解决和调试.希望对您有所帮助.

                  This took a LONG time to solve and debug. Hopefully it helps.

                  这篇关于如何修复/调试 scikit learn 中引发的这个多进程终止工作错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Python 多处理只使用一个核心 下一篇:超出最大递归深度.多处理和 bs4

                  相关文章

                  最新文章

                    <legend id='cq1yw'><style id='cq1yw'><dir id='cq1yw'><q id='cq1yw'></q></dir></style></legend>

                    <small id='cq1yw'></small><noframes id='cq1yw'>

                    • <bdo id='cq1yw'></bdo><ul id='cq1yw'></ul>
                    <i id='cq1yw'><tr id='cq1yw'><dt id='cq1yw'><q id='cq1yw'><span id='cq1yw'><b id='cq1yw'><form id='cq1yw'><ins id='cq1yw'></ins><ul id='cq1yw'></ul><sub id='cq1yw'></sub></form><legend id='cq1yw'></legend><bdo id='cq1yw'><pre id='cq1yw'><center id='cq1yw'></center></pre></bdo></b><th id='cq1yw'></th></span></q></dt></tr></i><div id='cq1yw'><tfoot id='cq1yw'></tfoot><dl id='cq1yw'><fieldset id='cq1yw'></fieldset></dl></div>

                  1. <tfoot id='cq1yw'></tfoot>