daniel-muthukrishna / astrorapid

Real-time Automated Photometric IDentification (RAPID) of astronomical transients using deep learning
https://astrorapid.readthedocs.io
MIT License
15 stars 14 forks source link

Astrorapid examples not running #2

Open raphaelshirley opened 5 years ago

raphaelshirley commented 5 years ago

Hi,

I am trying to run astrorapid and and getting a TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations', when try to run the examples (either the one here or the one on read the docs). I've attached the error trace below.

Any help in fixing this would be greatly appreciated.

Many thanks,

Raphael.


TypeError Traceback (most recent call last)

in () 15 light_curve_list = [(mjd, flux, fluxerr, passband, zeropoint, photflag, ra, dec, objid, redshift, mwebv)] 16 ---> 17 classification = Classify() 18 predictions, time_steps = classification.get_predictions(light_curve_list) 19 print(predictions) ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/astrorapid/classify.py in __init__(self, known_redshift, model_filepath, passbands, bcut, zcut, graph, model) 90 self.model = model 91 else: ---> 92 self.model = load_model(self.model_filepath) 93 94 def process_light_curves(self, light_curves): ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/engine/saving.py in load_model(filepath, custom_objects, compile) 417 f = h5dict(filepath, 'r') 418 try: --> 419 model = _deserialize_model(f, custom_objects, compile) 420 finally: 421 if opened_new_file: ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/engine/saving.py in _deserialize_model(f, custom_objects, compile) 223 raise ValueError('No model found in config.') 224 model_config = json.loads(model_config.decode('utf-8')) --> 225 model = model_from_config(model_config, custom_objects=custom_objects) 226 model_weights_group = f['model_weights'] 227 ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/engine/saving.py in model_from_config(config, custom_objects) 456 '`Sequential.from_config(config)`?') 457 from ..layers import deserialize --> 458 return deserialize(config, custom_objects=custom_objects) 459 460 ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/layers/__init__.py in deserialize(config, custom_objects) 53 module_objects=globs, 54 custom_objects=custom_objects, ---> 55 printable_module_name='layer') ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/utils/generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name) 143 config['config'], 144 custom_objects=dict(list(_GLOBAL_CUSTOM_OBJECTS.items()) + --> 145 list(custom_objects.items()))) 146 with CustomObjectScope(custom_objects): 147 return cls.from_config(config['config']) ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/engine/sequential.py in from_config(cls, config, custom_objects) 301 model.add(layer) 302 if not model.inputs and build_input_shape: --> 303 model.build(build_input_shape) 304 return model ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/engine/sequential.py in build(self, input_shape) 219 self.inputs = [x] 220 for layer in self._layers: --> 221 x = layer(x) 222 self.outputs = [x] 223 self._build_input_shape = input_shape ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/layers/recurrent.py in __call__(self, inputs, initial_state, constants, **kwargs) 530 531 if initial_state is None and constants is None: --> 532 return super(RNN, self).__call__(inputs, **kwargs) 533 534 # If any of `initial_state` or `constants` are specified and are Keras ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/engine/base_layer.py in __call__(self, inputs, **kwargs) 455 # Actually call the layer, 456 # collecting output(s), mask(s), and shape(s). --> 457 output = self.call(inputs, **kwargs) 458 output_mask = self.compute_mask(inputs, previous_mask) 459 ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/layers/recurrent.py in call(self, inputs, mask, training, initial_state) 1647 mask=mask, 1648 training=training, -> 1649 initial_state=initial_state) 1650 1651 @property ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/layers/recurrent.py in call(self, inputs, mask, training, initial_state, constants) 647 mask=mask, 648 unroll=self.unroll, --> 649 input_length=timesteps) 650 if self.stateful: 651 updates = [] ~/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in rnn(step_function, inputs, initial_states, go_backwards, mask, constants, unroll, input_length) 3009 parallel_iterations=32, 3010 swap_memory=True, -> 3011 maximum_iterations=input_length) 3012 last_time = final_outputs[0] 3013 output_ta = final_outputs[1] TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'
daniel-muthukrishna commented 5 years ago

Hi Raphael, Could you let me know what version of tensorflow and keras you have installed? I've also recently made some updates, so please try again on the new version by upgrading astrorapid with pip install astrorapid --upgrade Thanks, Daniel

raphaelshirley commented 5 years ago

Hi Daniel,

Thanks for getting back to me.

Here are the versions:

tensorflow 1.1.0 py36_0 conda-forge keras 2.2.4 py36_0 conda-forge

Upgrading astrorapid didn't fix the problem. I've attached my full environment in case that helps

I'll let you know if I figure it out.

Cheers,

Raphael.

env.txt

daniel-muthukrishna commented 5 years ago

Hi Raphael,

You have a very old version of TensorFlow - can I suggest that you upgrade tensorflow?

It looks like this is a known issue with the old version of tensorflow (https://github.com/keras-team/keras/issues/10631)

Cheers,

Daniel

raphaelshirley commented 5 years ago

Hi Daniel,

Yes that did it. Thanks very much and sorry to bother you when it wasn't an issue with your code.

We are thinking about training it on broad band photometry in addition to the images of the host. Have you got any experience doing that?

Thanks again,

Raphael.

daniel-muthukrishna commented 5 years ago

Hi Raphael,

No problem at all. Thanks for letting me know about the bug in the older TensorFlow.

I haven't done that specifically as I don't have an image of the host for ZTF, but I could imagine running the image of the host through a CNN and passing the features from that as contextual information in RAPID (or any light curve RNN). This sounds interesting, and I'd be happy to help out with it!

All the best,

Daniel

On Thu, 25 Jul 2019 at 05:28, Raphael Shirley notifications@github.com wrote:

Hi Daniel,

Yes that did it. Thanks very much and sorry to bother you when it wasn't an issue with your code.

We are thinking about training it on broad band photometry in addition to the images of the host. Have you got any experience doing that?

Thanks again,

Raphael.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/daniel-muthukrishna/astrorapid/issues/2?email_source=notifications&email_token=AEIAIGGEF3XQS3REJROYMQ3QBGE4HA5CNFSM4IFHCEE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2ZGGGA#issuecomment-515007256, or mute the thread https://github.com/notifications/unsubscribe-auth/AEIAIGEUN47ITQPGCTSQKZLQBGE4HANCNFSM4IFHCEEQ .