pymc-devs / pymc

Bayesian Modeling and Probabilistic Programming in Python
https://docs.pymc.io/
Other
8.63k stars 1.99k forks source link

BUG: Model Freezes on Linux Cluster After PyMC Upgrade to Version 5.16.2 #7466

Open Qiqil677 opened 1 month ago

Qiqil677 commented 1 month ago

Describe the issue:

I recently upgraded PyMC from version 5.6.1 to 5.16.2. After this upgrade, a specific model I use began freezing on a Linux cluster when processing certain datasets. However, when I run the same model on Windows, it completes without issues.

I'm wondering if there are any necessary code adaptations due to the version change or if this could be a platform-specific issue with the new version of PyMC.

Reproduceable code example:

import pymc as pm

with pm.Model() as model:
    Xobs_rain_bg = pm.MutableData('features', X, dims='id1')
    r = pm.Gamma("r", alpha=1, beta=0.1)
    beta_bg_rain = pm.HalfNormal("beta_bg_rain", sigma=0.5)
    mu = pm.Normal("mu", mu=0, sigma=10)

    # Calculation of beta
    beta = pm.math.exp(-(mu + beta_bg_rain * Xobs_rain_bg) / r)

    # Modeling
    y_obs = pm.Weibull("y_obs", alpha=r, beta=beta, observed=y, dims='id1')

    trace = pm.sample(draws=1000, tune=1000, cores=4, random_seed=123)

Error message:

No response

PyMC version information:

PyMC version: 5.16.2 (previously 5.6.1) Python version: 3.11 Operating System: Linux Cluster (Issue occurs) / Windows (No issues)

Context for the issue:

No response

welcome[bot] commented 1 month ago

Welcome Banner] :tada: Welcome to PyMC! :tada: We're really excited to have your input into the project! :sparkling_heart:
If you haven't done so already, please make sure you check out our Contributing Guidelines and Code of Conduct.

Qiqil677 commented 3 weeks ago

To troubleshoot, I downgraded to PyMC version 5.11.0, and the model worked as expected. However, the issue reappears in version 5.12.0 and persists in 5.16.0.

twiecki commented 3 weeks ago

Can you produce a MWE? Your example above does not have X defined.

Qiqil677 commented 2 weeks ago

Can you produce a MWE? Your example above does not have X defined.

Thank you for pointing that out! Here’s a Minimal Working Example (MWE) with X and y defined:

X = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

y = [2334.04147654, 2846.44111298, 2780.49424548, 2401.98756414, 2311.73179973, 2422.18600471, 2277.5640978 , 2275.13344549, 2584.25772382, 2359.26719436, 2550.07166362, 2372.18731778, 2429.68295437, 2471.68614174, 2768.87338308, 3006.07896156, 2060.07042254, 2321.23731872, 3061.20685094, 2151.30527497, 2869.39990587, 3167.88792256, 2132.24232896, 2203.94616385, 3008.45573369, 3177.89535861, 2664.58990591, 2429.61307619, 2643.81996099, 2642.09909828, 2999.88731572, 4039.4142271 , 2087.0900672 , 2037.97692102, 2367.52827389, 2831.34214914, 2468.14715007, 2468.0881853 , 2105.17728574, 2704.34750193, 2553.5523615 , 3073.46379813, 2774.85916964, 2506.13993805, 2971.56166803, 3310.64511642, 2900.81677548, 2631.55913542, 2068.20256281, 2078.56015185, 2829.60907819, 3024.1147541 , 3095.45086769, 2351.69434809, 2247.47943376, 2342.7637708 , 2783.04819324, 2288.53342117, 3054.52076625, 2432.87848262, 2974.41542001, 2923.45010842, 2898.71356672, 2841.80547052, 2928.49272665, 3371.13382511, 2572.30791481, 2743.08276305, 2926.64586783, 3170.21237775, 3067.64939517, 2822.07395413, 2686.61030298, 2938.55884213, 3707.42173319, 2722.88054536, 2963.79557753, 2817.45727596, 3009.28467386, 2549.2637098 , 2502.8447199 , 2524.75372349, 2634.72511401, 3081.73926243, 2941.31254199, 3179.15056454, 2949.73951664, 3442.56540222, 3622.56727756, 3441.52400435, 3723.5478912 , 3428.48490623, 3513.72408221, 3321.30465708, 3722.13823907, 3348.61689023, 2885.47482511, 3586.95076909, 2513.69404132, 3379.11646586, 3323.11538852, 3192.2443036 , 3227.32585514, 3424.6588307 , 3702.70756624, 3383.08217172, 3824.43250936, 3229.22456147, 2603.85498941, 3173.77869103, 2459.48007018, 3236.09572527, 3852.17101814, 2831.38199329, 2547.04940598, 2963.19167279, 2670.03241539, 3300.6897005 , 3704.13550729, 3160.1242254 , 3289.72092958, 3500.72499997, 3678.86933362, 3300.71993114, 3969.01246469, 3584.38758007, 3226.71967784, 3543.60502511, 3285.50887136, 3614.288952 , 3710.14605914, 2919.66515876, 3166.90381138, 3386.18550169, 2510.47201939, 2787.90988278, 3142.33185693, 2850.66198296, 2358.42774911, 2416.4196229 , 2106.80425136, 2453.42122362, 2121.22955753, 2602.45717404, 3052.90578502, 2642.10284817, 2957.75383969, 3020.68077591, 2727.25546359, 3513.59999645, 3360.98122251, 2687.27566003, 2241.02971224, 2458.30028055, 3263.3920426 , 3208.1407103 , 3300.7204531 , 2879.36775005, 2403.00819285, 3370.55609829, 3736.40910244, 3630.51043733, 3050.45833211, 2491.76323278, 2765.7631066 , 2923.31520436, 2908.68415227, 3206.10325757, 3544.73143186, 3713.3412322 , 3091.99433026, 3143.43465132, 2878.0851123 , 3134.87776818, 2926.18620627, 2841.49576115, 2700.24553635, 2395.1717903 , 2549.92874868, 2845.81959737, 2615.60187846, 2922.05436158, 2217.60529454, 2741.72562765, 2509.33684212, 2573.80986193, 3535.03988949, 2139.70729623, 2158.91900175, 2471.04687341, 2538.42745297, 2832.13245175, 2910.96892902, 2911.72262697, 3296.36542105, 3116.25252039, 2901.74147775, 2912.37348508, 2469.6200136 , 3245.512561 , 2364.19753975, 2813.74828737, 3103.98453494, 3080.01652709, 3088.37575554, 2630.45491222, 2382.11858124, 2347.55103173, 3104.21214882, 2574.38446752, 3120.54016965, 3125.04919447, 2270.42478624, 3057.62598971, 2737.97038862, 3659.17944176, 3052.88562846, 2428.85684445, 2682.50277846, 2857.55807533, 2774.07143144, 2827.19121418, 3054.16223746, 2761.40139718, 2451.09560609, 2709.0081435 , 3313.84743394, 2727.23352158, 3169.03888605, 2587.4862611 , 2398.7008366 , 2507.30912184, 2441.11587786, 2251.42893308, 2993.92502579, 2578.49191772, 3117.19327403, 3229.79459885, 2514.05707223, 2617.39333997, 2695.17004445, 2524.28300366, 3432.02733393, 3106.65133508, 2301.73146618, 2219.71019884, 2238.70231288, 2581.61664801, 2088.43650878, 2215.15448206, 2764.86647942, 2153.68728395, 2992.12848791, 2800.35688937, 2868.82234879, 2774.43234457, 2599.57595169, 2696.7579198 , 3038.56682387, 3052.45759941, 2778.53317759, 2641.13567686, 2357.94061015, 2636.29013136, 2388.82927866, 2869.09131738, 2956.73131072, 3160.82052298, 2754.29509715, 2344.69565833, 2257.59698835, 2162.73726487, 2051.81166123, 2240.02385102, 2273.63064468, 2051.50448629, 2146.73656792, 2444.39108164, 2521.67467069, 2423.28402455, 2050.39433316, 2394.84156041, 2790.77389176, 2423.77858069, 2326.92812226, 2083.96438473, 2675.36991586, 2505.57638849, 2419.46303998, 2998.73006762, 2397.01547133, 2297.28222448, 2288.06720529, 2823.96502566, 2597.91409252, 2331.56537213, 2392.40092508, 2614.24722027, 2339.12425722, 2367.14341508, 3060.12222747, 2397.42183743, 2420.13882485, 2792.16558436, 2101.06869255, 3092.03565922, 2940.96035277, 2576.53588742, 2954.08227616, 2332.54857369, 2623.2366833 , 2127.26142898, 2158.69771287, 2290.37650339, 2127.15679341, 2752.68900022, 2828.92493605, 2086.8084542 , 2730.87261016, 2207.01353414, 2209.27636858, 2008.77169556, 2321.33665844, 2182.8143582 , 2336.67508389, 2085.81754206, 2172.28350946, 2197.15075993, 2565.11174916, 3019.09524227, 2168.30649469, 2144.43905724, 2030.60996832, 2279.17891386, 2061.95730818, 2113.41411478, 2305.22556681, 1999.63169757, 2428.42471047, 2781.4844778 , 2225.89007414, 2261.15147084, 2322.02205882, 2309.79348151, 2192.77208415, 2173.57763809, 2569.50990391, 2127.14231262, 2732.70946681, 2365.20414192, 2215.57967234, 2440.84016859, 2468.49125238, 2535.06547237, 2477.42826719, 2595.67489115, 2890.95126146, 2434.26797724, 2324.02500362, 2021.39675294, 2214.27425822, 2671.17010233, 2632.28541152, 2224.44605168, 2367.33321409, 3562.09402343, 2757.95832075, 2434.55606866, 2779.63870794, 2595.58466764, 2281.28826638, 2954.06515037, 3081.34608614, 2406.12156919, 2127.18775 , 2630.42185923, 3151.69284668, 3510.46190288, 2552.4144064 , 2644.89052677, 2673.37129523, 2885.81709553, 3052.13242505, 2619.46602627, 2421.50078922, 2803.21382129, 2735.28229961, 2296.21621622, 2012.48021898, 2308.88943753, 2529.57005063, 2532.8154885 , 2489.31755303, 3336.0081145 , 2820.30487498, 3392.3255215 , 2455.45682103, 3212.34308668, 3046.54563792, 2277.68446065, 2899.95371734, 2877.37473413, 2008.26551553, 2523.43887517, 2151.47821402, 2376.06088128, 2941.26040428, 2214.21428571, 2654.67546077, 2456.41425492, 2013.18872017, 2399.30857194, 2328.00974817, 2371.18621101, 2970.73456688, 3692.39315823, 3022.41172232, 3021.72220835, 3131.77716872, 3825.14038243, 2900.41687663, 3847.74524471, 3866.6683628 , 4266.52542373, 3888.4896942 , 3721.67349458, 2676.44687763, 2832.0067051 , 2837.46881934, 2801.21143173, 3543.05666341, 3025.36809402, 3633.15959541, 3347.22287777, 3542.40499018, 4219.9432785 , 3806.0531296 , 4131.3797178 , 3487.77048779, 4420.62971933, 3827.77414075, 3991.11816019, 3925.00346693, 3938.45987688, 3798.84849824, 2595.60120576, 2686.89268658, 2317.771261 , 2616.52157575, 3149.58294717, 2376.91287943, 3139.08258973, 2706.88700061, 3487.10019626, 3489.60084403, 2784.12139872, 4095.27520371, 3904.95548643, 4184.42925955, 4340.47223146, 4367.99814033, 4221.94104886, 4077.57627611, 2979.47576587, 3133.91176254, 2822.11876916, 3419.31708572, 2909.01256074, 2337.94210989, 2593.20580475, 2037.86537641, 2979.49785177, 3270.52644653, 3915.82456969, 3498.67264772, 3457.24374204, 4373.61132547, 3405.54787759, 3831.45688073, 4414.88083131, 3766.84751973, 2735.59972054, 3290.25920372, 4235.00290177, 3965.33142785, 3926.10109539, 3217.85219182, 3637.20553541, 3211.15315674, 3397.66415468, 3556.56296612, 2724.6662559 , 3431.4274721 , 3749.52438353, 3933.44318232, 3910.74611218, 4372.66001623, 4183.34848404, 2860.56453823, 3218.29005263, 3632.68337976, 3573.90501919, 3735.81888662, 3628.67760427, 2986.11359571, 3560.75682419, 4126.4026778 , 4020.35657088, 3491.47549669, 2176.40677405, 2933.55545633, 3464.18610001, 3052.16757938, 3641.18633555, 3733.05902744, 3985.41239702, 3875.72541318, 3320.04366812, 3709.48703625, 3726.67868677, 3683.00729748, 3260.4427334 , 3052.38730934, 2769.13580247, 2805.99838505, 2808.35905961, 3150.32126837, 2730.5012914 , 2776.4010989 , 2922.98705534, 3516.50940179, 3540.39751867, 3832.48927915, 3413.52800041, 2896.22232227, 3284.7679014 , 4160.40284704, 3570.6254559 , 3912.75142003, 3574.76221153, 3755.18181818, 3992.54565785, 3274.88434312, 3600.69073583, 3586.84605738, 2958.49019988, 3052.76561878, 3289.21696436, 3570.16119464, 2646.89004849, 2945.42570069, 2816.87845639, 3422.0132181 , 3729.00318134, 3348.76084383, 2224.36738915, 2513.49456886, 3174.6617952 , 3204.6178634 , 3525.29770092, 4034.67370672, 3857.23076923, 3833.98658835, 3796.58593261, 4301.07339486, 4269.19652893, 3682.34751784, 4269.88200666, 4248.37524317, 3607.80205888, 4361.83111289, 2883.02781971, 3867.31429236, 3321.51878529, 3728.3850691 , 3838.7327131 , 4013.78298672, 4058.07651955, 3665.06232576, 3657.05856506, 3567.35803017, 4354.83666573, 4435.03527958, 4123.75303159, 4416.55310999, 3303.96250533, 4330.24484763, 3890.34940366, 3854.73868299, 4263.92348047, 3236.96223544, 3009.19989555, 4022.02095028, 4275.16304449, 4087.99733949, 4055.39631777, 4097.18760292, 2779.45365848, 2727.94866103, 2139.43569512, 3723.88672824, 3251.40047134, 4347.52941864, 3567.90513443, 3571.14770818, 4178.38794853, 3775.67989488, 3760.905672 , 4101.3652531 , 3904.3980404 , 4280.51504414, 3763.21049311, 2621.64004016, 3883.10895056, 4215.91847879, 3761.08684471, 3455.77545882, 2272.01894399, 2820.83801588, 4343.4644235 , 3764.02437598, 4242.65279534, 4296.30305518, 3991.90944997, 3408.95814969, 2971.9473003 , 3454.05211217, 2834.5478768 , 2989.61252151, 2643.59555479, 3668.88615074, 2268.49116547, 3289.341232 , 3461.3280706 , 3417.38368454, 3204.78966961, 3646.84364651, 2818.98777537, 2837.35381375, 3473.95362333, 4072.30788283, 2468.24988544, 4422.00847657, 3420.68408116, 2397.08011439, 2674.22236987]