HEP-PBSP / SIMUnet

The public code for SIMUnet, a NNPDF based tool to perform simultaneous determination of PDFs and EFT Wilson coefficients.
https://hep-pbsp.github.io/SIMUnet/
GNU General Public License v3.0
2 stars 2 forks source link

AttributeError: module 'numpy' has no attribute 'object'. #60

Closed flonigro closed 4 months ago

flonigro commented 4 months ago

When I run "vp-setupfit run1.yml", where run1.yml is the runcard from the documentation page "Simultaneous Fits", I get the following error:

(simunet) turing@LAPTOP-TSOLFVVP:~/simunet_git/SIMUnet/n3fit/runcards/examples/simunet_examples$ vp-setupfit run1.yml
[WARNING]: Using q2min from runcard
[WARNING]: Using w2min from runcard
/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/framework/dtypes.py:513: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
  np.object,
[CRITICAL]: Bug in setup-fit ocurred. Please report it.
Traceback (most recent call last):
  File "/home/turing/simunet_git/SIMUnet/n3fit/src/n3fit/scripts/vp_setupfit.py", line 197, in run
    super().run()
  File "/home/turing/simunet_git/SIMUnet/validphys2/src/validphys/app.py", line 158, in run
    super().run()
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/reportengine/app.py", line 384, in run
    rb.resolve_fuzzytargets()
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/reportengine/resourcebuilder.py", line 529, in resolve_fuzzytargets
    self.resolve_fuzzytarget(target)
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/reportengine/resourcebuilder.py", line 538, in resolve_fuzzytarget
    self.process_targetspec(fuzzytarget.name, spec, fuzzytarget.extraargs)
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/reportengine/resourcebuilder.py", line 549, in process_targetspec
    gen.send(None)
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/reportengine/resourcebuilder.py", line 609, in _process_requirement
    yield from self._make_node(name, nsspec, extraargs, parents)
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/reportengine/resourcebuilder.py", line 625, in _make_node
    yield from self._make_callspec(f, name, nsspec, extraargs, parents)
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/reportengine/resourcebuilder.py", line 714, in _make_callspec
    check(callspec=cs, ns=ns, graph=self.graph,
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/reportengine/checks.py", line 131, in check
    res = saturate(check_func, ns)
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/reportengine/utils.py", line 55, in saturate
    return func(**kwargs)
  File "/home/turing/simunet_git/SIMUnet/n3fit/src/n3fit/checks.py", line 172, in wrapper_check_NN
    check_optimizer(parameters["optimizer"])
  File "/home/turing/simunet_git/SIMUnet/n3fit/src/n3fit/checks.py", line 86, in check_optimizer
    from n3fit.backends import MetaModel
  File "/home/turing/simunet_git/SIMUnet/n3fit/src/n3fit/backends/__init__.py", line 1, in <module>
    from n3fit.backends.keras_backend.internal_state import (
  File "/home/turing/simunet_git/SIMUnet/n3fit/src/n3fit/backends/keras_backend/internal_state.py", line 15, in <module>
    import tensorflow as tf
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/__init__.py", line 46, in <module>
    from tensorflow.python import data
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/data/__init__.py", line 25, in <module>
    from tensorflow.python.data import experimental
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/data/experimental/__init__.py", line 96, in <module>
    from tensorflow.python.data.experimental import service
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/data/experimental/service/__init__.py", line 140, in <module>
    from tensorflow.python.data.experimental.ops.data_service_ops import distribute
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/data/experimental/ops/data_service_ops.py", line 25, in <module>
    from tensorflow.python.data.experimental.ops import compression_ops
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/data/experimental/ops/compression_ops.py", line 20, in <module>
    from tensorflow.python.data.util import structure
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/data/util/structure.py", line 26, in <module>
    from tensorflow.python.data.util import nest
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/data/util/nest.py", line 41, in <module>
    from tensorflow.python.framework import sparse_tensor as _sparse_tensor
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/framework/sparse_tensor.py", line 29, in <module>
    from tensorflow.python.framework import constant_op
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/framework/constant_op.py", line 29, in <module>
    from tensorflow.python.eager import execute
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/eager/execute.py", line 27, in <module>
    from tensorflow.python.framework import dtypes
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/tensorflow/python/framework/dtypes.py", line 513, in <module>
    np.object,
  File "/home/turing/miniconda3/envs/simunet/lib/python3.9/site-packages/numpy/__init__.py", line 324, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
LucaMantani commented 4 months ago

Hi, you need an older version of numpy.

See this issue for example, they suggest to install version 1.23.5. https://stackoverflow.com/questions/75069062/module-numpy-has-no-attribute-object

Something must have gone wrong in the build of your conda environment, this should be dealt with automatically.

flonigro commented 4 months ago

Thank you, @LucaMantani! Now I can run vp-setupfit run1.yml, then, I tried with "n3fit run1.yml 20" (just to see how it works) and "evolven3fit run1 20". With evolven3fit, I get the following:

(simunet) turing@LAPTOP-TSOLFVVP:~/simunet_git/SIMUnet/n3fit/runcards/examples/simunet_examples$ evolven3fit run1 20
Theory ID = 270
Skipping exportgrid (missing file): run1/nnfit/replica_1/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_2/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_3/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_4/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_5/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_6/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_7/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_8/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_9/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_10/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_11/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_12/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_13/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_14/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_15/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_16/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_17/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_18/run1.exportgrid
Skipping exportgrid (missing file): run1/nnfit/replica_19/run1.exportgrid
Read ExportGrid from: run1/nnfit/replica_20/run1.exportgrid
- Initialising evolution with 196 x-points
 WARNING: if there are external grids they cannot be locked
          ... unlocking subgrids

 Welcome to
      _/_/_/    _/_/_/_/   _/_/_/_/   _/_/_/_/   _/
    _/    _/   _/    _/   _/         _/         _/
   _/_/_/_/   _/_/_/_/   _/_/_/     _/_/_/     _/
  _/    _/   _/         _/         _/         _/
 _/    _/   _/         _/         _/_/_/_/   _/_/_/_/
 _____v3.0.7 A PDF Evolution Library, arXiv:1310.1394
      Authors: V. Bertone, S. Carrazza, J. Rojo

 Report of the evolution parameters:

 QCD evolution
 Space-like evolution (PDFs)
 Unpolarized evolution
 Evolution scheme: VFNS at N2LO
 Solution of the DGLAP equation: 'truncated' with maximum 5 active flavours
 - value of the truncation parameter epsilon = 1.000E-02
 Solution of the coupling equations: 'expanded' with maximum 5 active flavours
 Coupling reference value:
 - AlphaQCD( 91.2000 GeV) =  0.118000
 Pole heavy quark masses:
 - Mc =   1.5100 GeV
 - Mb =   4.9200 GeV
 - Mt = 172.5000 GeV
 The matching thresholds coincide with the physical masses
 muR / muF =  1.0000

 Allowed evolution range [   1.6500 : 100000.0000 ] GeV
 Computation of the evolution operator enabled

In particular, with "vp-setupfit", I get :

(simunet) turing@LAPTOP-TSOLFVVP:~/simunet_git/SIMUnet/n3fit/runcards/examples/simunet_examples$ vp-setupfit run1.yml
[WARNING]: Using q2min from runcard
[WARNING]: Using w2min from runcard
Using Keras backend
[INFO]: All requirements processed and checked successfully. Executing actions.
[INFO]: Verifying positivity tables:
[INFO]: POSF2U checked.
[INFO]: Filtering real data.
[INFO]: 204/209 datapoints in HERACOMBNCEP460 passed kinematic cuts.
[INFO]: 41/41 datapoints in CMSDY1D12 passed kinematic cuts.
[INFO]: 1/1 datapoints in ATLASTTBARTOT7TEV passed kinematic cuts.
[INFO]: 1/1 datapoints in ATLAS_TTBAR_8TEV_ASY passed kinematic cuts.
[INFO]: 1/1 datapoints in ATLAS_TTBARZ_8TEV_TOTAL passed kinematic cuts.
[INFO]: 1/1 datapoints in ATLAS_TTBARW_8TEV_TOTAL passed kinematic cuts.
[INFO]: 1/1 datapoints in ATLAS_SINGLETOP_TCH_7TEV_T passed kinematic cuts.
[INFO]: 1/1 datapoints in ATLAS_SINGLETOPW_8TEV_TOTAL passed kinematic cuts.
[INFO]: 2/2 datapoints in ATLAS_WHEL_13TEV passed kinematic cuts.
[INFO]: 1/1 datapoints in ATLAS_TTBARGAMMA_8TEV_TOTAL passed kinematic cuts.
[INFO]: 1/1 datapoints in ATLAS_SINGLETOPZ_13TEV_TOTAL passed kinematic cuts.
[INFO]: 19/19 datapoints in LEP_ZDATA passed kinematic cuts.
[INFO]: 22/22 datapoints in ATLAS_CMS_SSINC_RUNI passed kinematic cuts.
[INFO]: 10/10 datapoints in LEP_EEWW_182GEV passed kinematic cuts.
Killed

Should I open an other issue?

LucaMantani commented 4 months ago

In evolven3fit, it says that the files are missing, like the fit has not been performed. Not sure about the vp-setupfit, there is no error message in what you posted 😕

flonigro commented 4 months ago

Ok, thank you @LucaMantani ! I just ran again "evolven3fit run1 20" and it seems that the computation of the evolution operator has been done, even if I still get the message about the missing file. In [run1/nnfit/replica_20] folder, I see all files, as stated in Documentation page "Simultaneous Fits", with also run1.dat and weights.h5.

ElieHammou commented 4 months ago

Hi @flonigro , I'll close this issue as the numpy problem has been solved I believe. For the missing files in the evolution step it looks like something went wrong in the previous step. If you are still struggling with it please feel free to open a new dedicated issue for it with more details about the error.