Closed vic-chou closed 5 years ago
Is this the full error traceback? There must be something missing. For now I unfrotunately have no clue - I have never seen this error before. You need to provide more details and for example also the logfile and config file etc.
I list the full error traceback as follows: config - INFO All parameter-priors ok! config - INFO All hyper-parameters ok! config - INFO All hierarchical-parameters ok! models - INFO ... Initialising Distribution Optimizer ...
models - INFO Analysing problem ... models - INFO ---------------------
geodetic - INFO Number of geodetic datasets: 2 geodetic - INFO Number of geodetic data points: 419 geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances! geodetic - INFO Fit residual ramp selected! Traceback (most recent call last): File "/beat/python35/lib/python3.5/site-packages/pymc3/model.py", line 179, in get_context return cls.get_contexts()[-1] IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/beat/python35/lib/python3.5/site-packages/pymc3/distributions/distribution.py", line 24, in new model = Model.get_context() File "/beat/python35/lib/python3.5/site-packages/pymc3/model.py", line 181, in get_context raise TypeError("No context on context stack") TypeError: No context on context stack
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/.local/lib/python3.5/site-packages/beat-1.0rc1-py3.5-linux-x86_64.egg/beat/models/problems.py", line 339, in get_random_variables rvs[param.name] = Uniform(**kwargs) File "/beat/python35/lib/python3.5/site-packages/pymc3/distributions/distribution.py", line 26, in new raise TypeError("No model on context stack, which is needed to " TypeError: No model on context stack, which is needed to instantiate distributions. Add variable inside a 'with model:' block, or use the '.dist' syntax for a standalone distribution.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/beat/python35/bin/beat", line 11, in
I noticed that the content of problem_config in my config_ffo.yaml is different from the content shown in the website "https://hvasbath.github.io/beat/examples/FFO_static.html". There is no "hierarchicals" in my problem_config, which is listed on the website as follows. Should I add this part to my problem_config? hierarchicals: Laquila_ascxn_offset: !beat.heart.Parameter name: Laquila_ascxn_offset form: Uniform lower: [-0.004496268249748271] upper: [-0.004496268249748271] testvalue: [-0.004496268249748271] Laquila_ascxn_ramp: !beat.heart.Parameter name: Laquila_ascxn_ramp form: Uniform lower: [-0.00043773457168120667, -0.00023808150002277328] upper: [-0.00043773457168120667, -0.00023808150002277328] testvalue: [-0.00043773457168120667, -0.00023808150002277328] Laquila_dscxn_offset: !beat.heart.Parameter name: Laquila_dscxn_offset form: Uniform lower: [-0.003754963750062188] upper: [-0.003754963750062188] testvalue: [-0.003754963750062188] Laquila_dscxn_ramp: !beat.heart.Parameter name: Laquila_dscxn_ramp form: Uniform lower: [4.978325480108451e-05, -0.00025072248953317104] upper: [4.978325480108451e-05, -0.00025072248953317104] testvalue: [4.978325480108451e-05, -0.00025072248953317104]
I guess you are following the tutorial? Did you run the "beat import Laquila ... " step? The hierarchicals should have been imported in this step from your previous geometry optimization.
I run the "beat import Laquila --results=Laquila --mode='geometry' --datatypes=geodetic" step, it traceback is beat - INFO Attempting to load results with mode geometry from directory: Laquila config - INFO All parameter-priors ok! config - INFO All hyper-parameters ok! config - INFO All hierarchical-parameters ok! config - INFO All parameter-priors ok! config - INFO All hyper-parameters ok! config - INFO All hierarchical-parameters ok! models - INFO ... Initialising Geometry Optimizer ...
models - INFO Analysing problem ... models - INFO ---------------------
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 geodetic - INFO Number of geodetic datasets: 2 geodetic - INFO Number of geodetic data points: 419 geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances! geodetic - INFO Fit residual ramp selected! models - INFO ... Building model ...
models - INFO Optimization for 3 hyperparameters in total! seismic - INFO Seismic optimization on: depth, length, strike, rake, nucleation_x, east_shift, north_shift, nucleation_y, width, slip, time, dip seismic - INFO Retrieving seismic data-covariances with structure "non-toeplitz" for any_P_0 ... seismic - INFO Preparing data of "any_P_0" for optimization seismic - INFO Initializing synthesizer for "any_P_0" geodetic - INFO Geodetic optimization on: depth, length, strike, rake, east_shift, north_shift, width, slip, dip geodetic - INFO Estimating ramp for each dataset... geodetic - INFO Initialized 4 hierarchical parameters (ramps). models - INFO Model building was successful!
backend - INFO Loading multitrace from /data4/gyxu/beat/testbeat/Laquila/geometry/stage-1 beat - INFO Importing ramp parameters ... config - WARNING Prior for variable Laquila_dscxn_ramp does not exist! Bounds not updated! config - WARNING Prior for variable Laquila_ascxn_ramp does not exist! Bounds not updated! config - WARNING Prior for variable Laquila_dscxn_offset does not exist! Bounds not updated! config - WARNING Prior for variable Laquila_ascxn_offset does not exist! Bounds not updated! beat - INFO Importing non-linear source geometry results! config - WARNING Prior for variable time does not exist! Bounds not updated! beat - INFO Successfully updated config file!
I find that there is "hierarchicals" in my config_geometry.yaml file, but not in the config_ffo.yaml. I following the steps in the tutorial. Can you give me some suggestion?
Did you optimize for the orbital ramp parameters in your geometry step? Apparently there are no ramp results to be imported. If you did not run it simply put the fit_planes flag to false, update your config with beat update- as described on the webpage and your config file should be consistent again.
When I put the fit_planes flag to false, I can run the "beat sample Laquila --hypers --mode=ffo" successfully. But when I run "beat sample Laquila --mode=ffo", I meet the error config - INFO All parameter-priors ok! config - INFO All hyper-parameters ok! config - INFO All hierarchical-parameters ok! models - INFO ... Initialising Distribution Optimizer ...
models - INFO Analysing problem ... models - INFO ---------------------
geodetic - INFO Number of geodetic datasets: 2 geodetic - INFO Number of geodetic data points: 419 geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances! models - INFO Using "none" regularization ... models - INFO ... Building model ...
models - INFO Optimization for 2 hyperparameters in total! geodetic - INFO Loading geodetic Green's Functions ffo - INFO Setting geodetic_uparr_static_0 GF Library to optimization mode. ffo - INFO Setting geodetic_uperp_static_0 GF Library to optimization mode. geodetic - INFO Initialized 0 hierarchical parameters (ramps). models - INFO Model building was successful!
models - INFO ... Initiate Sequential Monte Carlo ... n_chains=1000, tune_interval=50, n_jobs=1, proposal_distribution: MultivariateNormal,
models - INFO Compilation time: 4.386736 models.base - INFO Chain initialization with: models.base - INFO Random starting point.
models.base - INFO ... Starting SMC ...
backend - INFO Reloading existing results ...
backend - INFO Loading multitrace from /beat/test_beat/Laquila/ffo/stage_0
backend - INFO Init new trace!
smc - INFO Sample initial stage: ...
smc - INFO Beta: 0.000000 Stage: 0
sampler - INFO Initialising 1000 chain traces ...
sampler - INFO Serial time per sample: 0.000354
sampler - INFO Not using shared memory.
sampler - INFO Sampling ...
Traceback (most recent call last):
File "/beat/python35/bin/beat", line 11, in
And I noticed that in my updated config_ffo.yaml, there is no h_laplacian: !beat.heart.Parameter name: h_laplacian form: Uniform lower: [-5.0] upper: [5.0] testvalue: [0.5]
Can you give me some suggestion?
Please put the rm_flag under the SMC sampler config to true. At the moment it tries to load your previously failed sampling. Or please remove the stage_0 results.
Please read the regularization section in the tutorial...
Thanks for your help! I can run it successfully under your suggestion.
Hi Hannes, I meet the the same error. I have put the rm_flag under the SMC sampler config to true and also tried to remove the stage_0 results, but it still appears the error. I also set the fit_plane to false because I don't have hierarchical data. fangnandeMacBook-Pro:beat_learning NAN$ beat sample Laquila --mode=ffo config - INFO All parameter-priors ok! config - INFO All hyper-parameters ok! config - INFO All hierarchical-parameters ok! models - INFO ... Initialising Distribution Optimizer ...
models - INFO Analysing problem ... models - INFO ---------------------
geodetic - INFO Number of geodetic datasets: 2 geodetic - INFO Number of geodetic data points: 419 geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances! models - INFO ... Building model ...
models - INFO Optimization for 3 hyperparameters in total! geodetic - INFO Loading geodetic Green's Functions ffo - INFO Setting geodetic_uparr_static_0 GF Library to optimization mode. ffo - INFO Setting geodetic_uperp_static_0 GF Library to optimization mode. geodetic - INFO Initialized 0 hierarchical parameters (ramps). ffo.laplacian - INFO Initialising Laplacian smoothing operator ... models - INFO Model building was successful!
models - INFO ... Initiate Sequential Monte Carlo ... n_chains=1000, tune_interval=50, n_jobs=1, proposal_distribution: MultivariateNormal,
models - INFO Compilation time: 14.379401 models.base - INFO Chain initialization with: models.base - INFO Random starting point.
models.base - INFO ... Starting SMC ...
backend - INFO Removing previous sampling results ... /Users/NAN/Documents/beat_learning/Laquila/ffo/stage_0
backend - INFO Init new trace!
smc - INFO Sample initial stage: ...
smc - INFO Beta: 0.000000 Stage: 0
sampler - INFO Initialising 1000 chain traces ...
sampler - INFO Serial time per sample: 0.000364
sampler - INFO Not using shared memory.
sampler - INFO Sampling ...
Traceback (most recent call last):
File "/anaconda3/bin/beat", line 11, in
Can you give me some suggestions? Thank you very much.
Hi Nan! Thanks for noticing! I think this is related to a problem in the code. For you it is easy to fix. Can you please set the number of processors to use to higher than one,- I hope you have several CPUs? If you only use one core it will run quite a long time. It is the n_jobs parameter in the sampler_parameter config. Anyways I will have to fix it that it also runs for a single core ...
It should be working now with n_jobs = 1 as well after you update. It is fixed in this commit : https://github.com/hvasbath/beat/commit/10132e979b40f70bf37be0b90dc21fb3e30e5560
Hi Hannes, Thank you for your suggestions. After I set the n_jobs to 4, it's running well now.
Hi, When I running "beat sample Laquila --hypers --mode=ffo" in Scenario II, I meet a error that beat sample Laquila --mode=ffo config - INFO All parameter-priors ok! config - INFO All hyper-parameters ok! config - INFO All hierarchical-parameters ok! models - INFO ... Initialising Distribution Optimizer ... models - INFO Analysing problem ... models - INFO --------------------- geodetic - INFO Number of geodetic datasets: 2 geodetic - INFO Number of geodetic data points: 419 geodetic - WARNING Covariance estimation not implemented (yet)! Using imported covariances! geodetic - INFO Fit residual ramp selected! Traceback (most recent call last): File "/beat/python35/lib/python3.5/site-packages/pymc3/model.py", line 179, in get_context return cls.get_contexts()[-1] IndexError: list index out of range
Can you help me solve this problem? Thank you!