Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample issue #144

Open
qboHu opened this issue Dec 30, 2024 · 3 comments
Open

Sample issue #144

qboHu opened this issue Dec 30, 2024 · 3 comments

Comments

@qboHu
Copy link

qboHu commented Dec 30, 2024

Dear developer, thank you for the code. I encountered the following reported error when processing to the sampling step:

beat sample Laquila --hypers
To enable 'bem' mode packages 'pygmsh' and 'cutde' need to be installed.
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
models - INFO ... Initialising Geometry Optimizer ...

models - INFO Analysing problem ...
models - INFO ---------------------

models - INFO Using RectangularSource for 1 sources for event --- !pf.Event
lat: 42.29
lon: 13.35
time: '2009-04-06 01:32:49.190000057'
depth: 12000.0
name: '200904060132A'
magnitude: 6.343080192483292
region: 'CENTRAL ITALY'
catalog: 'gCMT'
moment_tensor: !pf.MomentTensor
mnn: 1.43e+18
mee: 1.87e+18
mdd: -3.3e+18
mne: 1.77e+18
mnd: -1.43e+18
med: 2.6900000000000003e+17
strike1: 120.23408298515041
dip1: 54.240869089580485
rake1: -112.81739742081386
strike2: 335.98575923255856
dip2: 41.58440373860804
rake2: -61.69749587601104
moment: 3.6696131948749036e+18
magnitude: 6.343080192483292
duration: 7.0

/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/pytensor/tensor/sharedvar.py:13: FutureWarning: The class ScalarSharedVariable has been deprecated. Use TensorSharedVariable instead and check for ndim==0.
warnings.warn(
geodetic - INFO Number of geodetic datasets: 2
geodetic - INFO Initialising corrections ...
heart - INFO Setting up Ramps correction for Laquila_dscxn
heart - INFO Masking data for Ramps estimation!
heart - INFO Not correcting Laquila_dscxn for Euler Pole
heart - INFO Not correcting Laquila_dscxn for Strain Rate
heart - INFO Setting up Ramps correction for Laquila_ascxn
heart - INFO Masking data for Ramps estimation!
heart - INFO Not correcting Laquila_ascxn for Euler Pole
heart - INFO Not correcting Laquila_ascxn for Strain Rate
geodetic - INFO Number of geodetic data points: 419
geodetic - INFO Initialising geometry geodetic composite ...
seismic - INFO Loading seismic data for event 0 from: /home/bo/data/beat/models/Laquila/seismic_data.pkl
seismic - INFO Initialising seismic wavemap for "any_P" ...
heart - INFO Consistent number of datasets and targets in any_P_0 wavemap!
heart - INFO Number of seismic datasets for wavemap: any_P_0: 35

models - INFO ... Building Hyper model ...

geodetic - INFO Evaluating config for Ramps corrections for datasets...
geodetic - INFO Evaluating config for Euler Pole corrections for datasets...
geodetic - INFO No Euler Pole correction!
geodetic - INFO Evaluating config for Strain Rate corrections for datasets...
geodetic - INFO No Strain Rate correction!
geodetic - INFO Initialized 6 hierarchical parameters.
models - INFO Initialised hyperparameter h_SAR with size 2
models - INFO Initialised hyperparameter h_any_P_0_Z with size 1
models - INFO Initialized 3 hyperparameters in total!
geodetic - INFO Retrieving geodetic data-covariances with structure "import" for Laquila_dscxn ...
geodetic - INFO Retrieving geodetic data-covariances with structure "import" for Laquila_ascxn ...
heart - INFO Did not find custom arrival times.
heart - INFO Using theoretical arrival times for "any_P_0"
seismic - INFO Retrieving seismic data-covariances with structure "non-toeplitz" for any_P_0 ...
seismic - INFO Initialising weights ...
heart - INFO Did not find custom arrival times.
heart - INFO Using theoretical arrival times for "any_P_0"
models - INFO Hyper model building was successful!
models - INFO Using "bin" backend to store samples!
models - INFO ... Initiate Metropolis ...
proposal_distribution: Normal, tune_interval=50, n_jobs=4

metropolis - INFO Creating initial population for 12 chains ...
Sampling: [h_SAR, h_any_P_0_Z]
pymc.sampling.forward - INFO Sampling: [h_SAR, h_any_P_0_Z]
metropolis - INFO Compiling model graph ...
Traceback (most recent call last):
File "/home/bo/anaconda3/envs/beatenv/bin/beat", line 8, in
sys.exit(main())
^^^^^^
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/beat/apps/beat.py", line 2441, in main
globals()"command_" + command
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/beat/apps/beat.py", line 1063, in command_sample
step = problem.init_sampler(hypers=options.hypers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/beat/models/problems.py", line 151, in init_sampler
step = sampler.Metropolis(
^^^^^^^^^^^^^^^^^^^
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/beat/sampler/metropolis.py", line 125, in init
self.compile_model_graph(model)
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/beat/sampler/metropolis.py", line 178, in compile_model_graph
out_vars=[model.varlogp],
^^^^^^^^^^^^^
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/pymc/model/core.py", line 810, in varlogp
return self.logp(vars=self.free_RVs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/pymc/model/core.py", line 696, in logp
rv_logps = transformed_conditional_logp(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/pymc/logprob/basic.py", line 595, in transformed_conditional_logp
temp_logp_terms = conditional_logp(
^^^^^^^^^^^^^^^^^
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/pymc/logprob/basic.py", line 479, in conditional_logp
fgraph = construct_ir_fgraph(rv_values, ir_rewriter=ir_rewriter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/pymc/logprob/rewriting.py", line 249, in construct_ir_fgraph
replacements = tuple((rv, valued_rv(rv, value)) for rv, value in ir_rv_values.items())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/pymc/logprob/rewriting.py", line 249, in
replacements = tuple((rv, valued_rv(rv, value)) for rv, value in ir_rv_values.items())
^^^^^^^^^^^^^^^^^^^^
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/pytensor/graph/op.py", line 304, in call
compute_test_value(node)
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/pytensor/graph/op.py", line 125, in compute_test_value
thunk()
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/pytensor/graph/op.py", line 531, in rval
r = p(n, [x[0] for x in i], o)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bo/anaconda3/envs/beatenv/lib/python3.11/site-packages/pymc/logprob/abstract.py", line 245, in perform
raise NotImplementedError("ValuedVar should not be present in the final graph!")
NotImplementedError: ValuedVar should not be present in the final graph!

Is this error due to the wrong version of the package, or is there something wrong with the previous steps (the previous steps didn't report an error)?

@hvasbath
Copy link
Owner

hvasbath commented Jan 5, 2025

Hi please install pymc version 5.16.2 and it will be fixed. Please see here where this was discussed before. I will release a new beat version constraining this during next week. Sorry for the inconvenience!

@hvasbath
Copy link
Owner

hvasbath commented Jan 5, 2025

I just released the new version 2.0.4. Just running the standard pip installation should install the correct pymc version now. Please confirm if it works.

@qboHu
Copy link
Author

qboHu commented Jan 6, 2025

Thank you very much for your reply, I'll try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants