Is it possible to use GemPy in Google Colaboratory? #714
Unanswered
andresalfp
asked this question in
Q&A
Replies: 1 comment
-
Hi @andresalfp, you are welcome to try out the GemPy TensorFlow distribution repo, where we have a demo running on Google Colab. But be careful, some features are under development. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone!
I was trying to use GemPy in colab, but I'm getting a theano error when creating the model. Here's my code:
!pip install gempy
import gempy as gp
from ipywidgets import interact
import numpy as np
import pandas as pd
import matplotlib.image as mpimg
test_model = gp.create_model('test_model')
After executing the last line of code, I get the following error:
TypeError Traceback (most recent call last)
in ()
1 # Initializing model
----> 2 geo_model = gp.create_model('hola') # giving name to our model
12 frames
/usr/local/lib/python3.7/dist-packages/gempy/gempy_api.py in create_model(project_name)
112 TODO: Adding saving address
113 """
--> 114 return Project(project_name)
115
116
/usr/local/lib/python3.7/dist-packages/gempy/core/model.py in init(self, project_name)
1617
1618 self.meta = MetaData(project_name=project_name)
-> 1619 super().init()
1620
1621 def repr(self):
/usr/local/lib/python3.7/dist-packages/gempy/core/model.py in init(self)
89 self._surfaces,
90 self._stack, self._faults,
---> 91 self._additional_data)
92
93 self.solutions = Solution(self._grid, self._surfaces, self._stack)
/usr/local/lib/python3.7/dist-packages/gempy/core/interpolator.py in init(self, surface_points, orientations, grid, surfaces, series, faults, additional_data, **kwargs)
649
650 super().init(surface_points, orientations, grid, surfaces, series, faults,
--> 651 additional_data, **kwargs)
652 self.len_series_i = np.zeros(1)
653 self.len_series_o = np.zeros(1)
/usr/local/lib/python3.7/dist-packages/gempy/core/interpolator.py in init(self, surface_points, orientations, grid, surfaces, series, faults, additional_data, **kwargs)
59
60 self.dtype = additional_data.options.df.loc['values', 'dtype']
---> 61 self.theano_graph = self.create_theano_graph(additional_data, inplace=False)
62 self.theano_function = None
63
/usr/local/lib/python3.7/dist-packages/gempy/core/interpolator.py in create_theano_graph(self, additional_data, inplace, output, **kwargs)
120 verbose=additional_data.options.df.loc['values', 'verbosity'],
121 output=output,
--> 122 **kwargs)
123 if inplace is True:
124 self.theano_graph = graph
/usr/local/lib/python3.7/dist-packages/gempy/core/theano_modules/theano_graph_pro.py in init(self, optimizer, verbose, dtype, output, **kwargs)
233 self.polarity = self.polarity_all
234
--> 235 rest_ref_aux = self.set_rest_ref_matrix(self.number_of_points_per_surface_T)
236 self.ref_layer_points_all = rest_ref_aux[0]
237 self.rest_layer_points_all = rest_ref_aux[1]
/usr/local/lib/python3.7/dist-packages/gempy/core/theano_modules/theano_graph_pro.py in set_rest_ref_matrix(self, number_of_points_per_surface)
804 non_sequences=[T.as_tensor(3)],
805
--> 806 return_list=False)
807
808 # ref_points_loop = theano.printing.Print('loop')(ref_points_loop)
/usr/local/lib/python3.7/dist-packages/theano/scan_module/scan.py in scan(fn, sequences, outputs_info, non_sequences, n_steps, truncate_gradient, go_backwards, mode, name, profile, allow_gc, strict, return_list)
847 optimizer=None),
848 on_unused_input='ignore',
--> 849 profile=False)
850 except gof.fg.MissingInputError as err:
851 msg = ("\nPlease pass this variable to the scan's inner function. Do "
/usr/local/lib/python3.7/dist-packages/theano/compile/function/init.py in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input)
348 on_unused_input=on_unused_input,
349 profile=profile,
--> 350 output_keys=output_keys,
351 )
352 return fn
/usr/local/lib/python3.7/dist-packages/theano/compile/function/pfunc.py in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys)
425 # transform params into theano.compile.In objects.
426 inputs = [
--> 427 _pfunc_param_to_in(p, allow_downcast=allow_input_downcast) for p in params
428 ]
429
/usr/local/lib/python3.7/dist-packages/theano/compile/function/pfunc.py in (.0)
425 # transform params into theano.compile.In objects.
426 inputs = [
--> 427 _pfunc_param_to_in(p, allow_downcast=allow_input_downcast) for p in params
428 ]
429
/usr/local/lib/python3.7/dist-packages/theano/compile/function/pfunc.py in _pfunc_param_to_in(param, strict, allow_downcast)
541 elif isinstance(param, In):
542 return param
--> 543 raise TypeError(f"Unknown parameter type: {type(param)}")
544
545
TypeError: Unknown parameter type: <class 'theano.tensor.var.TensorVariable'>
Is there any workaround to solve this error?
Thanks in advance!
Andrés
Beta Was this translation helpful? Give feedback.
All reactions