galeone / dynamic-training-bench

Simplify the training and tuning of Tensorflow models
Mozilla Public License 2.0
213 stars 31 forks source link

SyntaxError #9

Closed JustWon closed 7 years ago

JustWon commented 7 years ago

I upgraded the library but I got the similar problem.. When I type the following command, dytb_train --model LeNet --dataset MNIST

File "/home/dongwonshin/Desktop/venv/bin/dytb_train", line 58 row = {**info["stats"], "path": info["paths"]["best"], "time": time.strftime("%Y-%m-%d %H:%M")} ^ SyntaxError: invalid syntax

I got this message.

This is very wired.. even I created a virtual environment using python3 and I installed Tensorflow on it..

galeone commented 7 years ago

That's strange. I can run the same command without any problem. Can you please provide the output of

  1. python3 -V
  2. dytb_train ( I want to check if the script can be invoked correctly)
  3. python -c "import dytb; print(dytb.__version__)"

Let's figure out what the problem is

JustWon commented 7 years ago

(venv) dongwonshin@dongwonshin-All-Series  ~/Desktop  python3 -V
Python 3.4.3

(venv) dongwonshin@dongwonshin-All-Series  ~/Desktop  dytb_train
File "/home/dongwonshin/Desktop/venv/bin/dytb_train", line 58 row = {**info["stats"], "path": info["paths"]["best"], "time": time.strftime("%Y-%m-%d %H:%M")} ^ SyntaxError: invalid syntax

(venv) ✘ dongwonshin@dongwonshin-All-Series  ~/Desktop  python -c "import dytb; print(dytb.version)" 0.4.6

That's what I've got.

galeone commented 7 years ago

Hm.. I'm going to setup a local python3.4 environment to test with it. Meanwhile, can you try to create a local environment using python3.6? I'm using it at the moment and I can run everything (anyway is strange, I don't think that there are syntax differences between python 3.6 and 3.4)

galeone commented 7 years ago

Alright, I figured it out. There's something different between python 3.4 and 3.6 (I haven't checked it in 3.5), the "dictionary unpacking" (the ** operator) can be used only in function call (like add(**dict) where add is defined like add(a,b): operations but not elsewhere, sadly.

If you know how to unpack a dictionary in python < 3.6 and then use the resulting unpack to expand another dictionary feel free to submit a pull request. Otherwise, I'll write in the README.md that DyTB works only with python 3.6 (and later version, until other breaking changes).

JustWon commented 7 years ago

At the same time, I also found out dytb_train command works well with python 3.6!! OMG..

JustWon commented 7 years ago

Thank you for helping me out. Currently, I'm interested in Convolutional Autoencoder to extract features for Places 365 datasets. http://places2.csail.mit.edu/ Still, I have some minor errors with dytb_train, but I would try to solve it.

JustWon commented 7 years ago

I have a question. In your article (https://pgaleone.eu/neural-networks/deep-learning/2016/12/13/convolutional-autoencoders-in-tensorflow/), the train_autoencoder.py is dytb/trainers/AutoencoderTrainer.py in this repository?

galeone commented 7 years ago

The article reference an old DyTB implementation.

Right now you can just use dytb_train that automatically understand the type of model you want to train and invokes the right trainer. Here's the list of the available trainers: https://github.com/galeone/dynamic-training-bench/tree/master/dytb/trainers

One train per supported model type. Just implement the right interface (look at the predefined model & predefined inputs to understand how if you want to see some example) and have fun.

Here's the list of the predefined models: https://github.com/galeone/dynamic-training-bench/tree/master/dytb/models/predefined

and here's the list of the predefined inputs: https://github.com/galeone/dynamic-training-bench/tree/master/dytb/inputs/predefined

Give a look even at DyTB used as a Python library (that's more powerful that using it as a CLI tool) :https://github.com/galeone/dynamic-training-bench/blob/master/examples/VGG-Cifar10-100-TransferLearning-FineTuning.ipynb

JustWon commented 7 years ago

Thank you very much. Finally, I'm operating "dytb_train --model LeNet --dataset MNIST" command without any problems. I would extend it with the place dataset. Thank you again! :-)

galeone commented 7 years ago

If you create a good input interface implementation for a known dataset we could place it into the predefined inputs folder in order to make it available to everyone! Think about it! You're welcome. If you want to contribute just use PR and issues again.