NNPDF / nnpdf

An open-source machine learning framework for global analyses of parton distributions.
https://docs.nnpdf.science/
GNU General Public License v3.0
30 stars 6 forks source link

pdfflow error on mac #2033

Closed APJansen closed 7 months ago

APJansen commented 7 months ago

When running for instance: pytest -v test_hyperopt.py::test_restart_from_pickle.

(n3fit runs fine though, on the basic runcard)

I get the error:

[INFO]: All requirements processed and checked successfully. Executing actions.
[INFO] (pdfflow.pflow) Loading member 0 from NNPDF40_nnlo_as_01180
[INFO]: Loading member 0 from NNPDF40_nnlo_as_01180
[CRITICAL]: Bug in n3fit ocurred. Please report it.
Traceback (most recent call last):
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/n3fit/src/n3fit/scripts/n3fit_exec.py", line 332, in run
    super().run()
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/app.py", line 151, in run
    super().run()
  File "/Users/aronjansen/.pyenv/versions/3.9.4/lib/python3.9/site-packages/reportengine/app.py", line 380, in run
    rb.execute_sequential()
  File "/Users/aronjansen/.pyenv/versions/3.9.4/lib/python3.9/site-packages/reportengine/resourcebuilder.py", line 166, in execute_sequential
    result = self.get_result(callspec.function,
  File "/Users/aronjansen/.pyenv/versions/3.9.4/lib/python3.9/site-packages/reportengine/resourcebuilder.py", line 175, in get_result
    fres =  function(**kwdict)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/covmats.py", line 253, in dataset_t0_predictions
    return central_predictions(dataset, t0set).to_numpy().reshape(-1)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/convolution.py", line 233, in central_predictions
    return _predictions(dataset, pdf, central_fk_predictions)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/convolution.py", line 166, in _predictions
    all_predictions.append(fkfunc(fk_w_cuts, pdf))
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/convolution.py", line 302, in central_fk_predictions
    return central_hadron_predictions(loaded_fk, pdf)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/convolution.py", line 412, in central_hadron_predictions
    return _gv_hadron_predictions(loaded_fk, gv)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/convolution.py", line 335, in _gv_hadron_predictions
    gv1 = gv1func(qmat=[Q], vmat=FK_FLAVOURS, xmat=xgrid).squeeze(-1)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/pdfbases.py", line 308, in central_grid_values
    return self.apply_grid_values(func, vmat, xmat, qmat)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/pdfbases.py", line 422, in apply_grid_values
    gv = func(flmat, xmat, qmat)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/gridvalues.py", line 114, in central_grid_values
    return _grid_values(pdf.load_t0(), flmat, xmat, qmat)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/gridvalues.py", line 57, in _grid_values
    return lpdf.grid_values(flmat, xmat, qmat)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/lhapdfset.py", line 116, in grid_values
    raw = np.array([member.xfxQ(flavors, xarr, qarr) for member in self.members]).swapaxes(1, 2)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/lhapdfset.py", line 116, in <listcomp>
    raw = np.array([member.xfxQ(flavors, xarr, qarr) for member in self.members]).swapaxes(1, 2)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/lhapdf_compatibility.py", line 84, in xfxQ
    ret_dict = self.xfxQ(b, c)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/lhapdf_compatibility.py", line 80, in xfxQ
    return self._xfxQ_all_pid(a, b)
  File "/Users/aronjansen/Dropbox/eScience/projects/protonStructure/nnpdfgit/nnpdf/validphys2/src/validphys/lhapdf_compatibility.py", line 66, in _xfxQ_all_pid
    res = self.pdf.py_xfxQ2_allpid(x, q**2).numpy()
  File "/Users/aronjansen/.pyenv/versions/3.9.4/lib/python3.9/site-packages/pdfflow/pflow.py", line 433, in py_xfxQ2_allpid
    return self.xfxQ2_allpid(a_x, a_q2)
  File "/Users/aronjansen/.pyenv/versions/3.9.4/lib/python3.9/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/Users/aronjansen/.pyenv/versions/3.9.4/lib/python3.9/site-packages/pdfflow/pflow.py", line 394, in xfxQ2_allpid
    return self.xfxQ2(pid, a_x, a_q2)
  File "/Users/aronjansen/.pyenv/versions/3.9.4/lib/python3.9/site-packages/pdfflow/pflow.py", line 350, in xfxQ2
    f_f = self._xfxQ2(pid_idx, a_x, a_q2)
  File "/Users/aronjansen/.pyenv/versions/3.9.4/lib/python3.9/site-packages/pdfflow/pflow.py", line 266, in _xfxQ2
    res += subgrid(shape, a_q2, pids=u, arr_x=a_x)
  File "/Users/aronjansen/.pyenv/versions/3.9.4/lib/python3.9/site-packages/pdfflow/subgrid.py", line 181, in __call__
    result = self.fn_interpolation(
  File "/Users/aronjansen/.pyenv/versions/3.9.4/lib/python3.9/site-packages/pdfflow/functions.py", line 161, in first_subgrid
    if tf.size(f_idx) != 0:
tensorflow.python.framework.errors_impl.OperatorNotAllowedInGraphError: Using a symbolic `tf.Tensor` as a Python `bool` is not allowed. You can attempt the following resolutions to the problem: If you are running in Graph mode, use Eager execution mode or decorate this function with @tf.function. If you are using AutoGraph, you can try decorating this function with @tf.function. If that does not work, then you may be using an unsupported feature or your source code may not be visible to AutoGraph. See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/autograph/g3doc/reference/limitations.md#access-to-source-code for more information.
scarlehoff commented 7 months ago

I've moved the issue to https://github.com/N3PDF/pdfflow/issues/64