liyaguang / DCRNN

Implementation of Diffusion Convolutional Recurrent Neural Network in Tensorflow
MIT License
1.21k stars 400 forks source link

get error when generating data. #15

Closed nnzhan closed 5 years ago

nnzhan commented 5 years ago

Could you please help me fix the error. When I run

python -m scripts.generate_training_data --output_dir=data/METR-LA

I get the following logs

Traceback (most recent call last):
  File "/home/zhwu/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/home/zhwu/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/zhwu/workspace/DCRNN/scripts/generate_training_data.py", line 123, in <module>
    main(args)
  File "/home/zhwu/workspace/DCRNN/scripts/generate_training_data.py", line 108, in main
    generate_train_val_test(args)
  File "/home/zhwu/workspace/DCRNN/scripts/generate_training_data.py", line 85, in generate_train_val_test
    x_train, y_train = x[:num_train], y[:num_train]
TypeError: slice indices must be integers or None or have an __index__ method
zwd2016 commented 5 years ago

I think this is a problem caused by the division syntax of the Python 2.7 version. You can run this code in Python 3.5.

nnzhan commented 5 years ago

thanks, it solves my problem

liyaguang commented 5 years ago

Thanks @zwd2016 . Glad it solves the problem.

Lorrainexun commented 5 years ago

Hi can you help me with this error. When generating data, I got the following logs:

C:\Users\mlvis\Documents\Emma\DCRNN>python -m scripts.generate_training_data --output_dir=data/METR-LA --traffic_df_filename=data/metr-la.h5 Generating training data Traceback (most recent call last): File "C:\Users\mlvis\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\mlvis\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\mlvis\Documents\Emma\DCRNN\scripts\generate_training_data.py", line 123, in main(args) File "C:\Users\mlvis\Documents\Emma\DCRNN\scripts\generate_training_data.py", line 108, in main generate_train_val_test(args) File "C:\Users\mlvis\Documents\Emma\DCRNN\scripts\generate_training_data.py", line 72, in generate_train_val_test add_day_in_week=False, File "C:\Users\mlvis\Documents\Emma\DCRNN\scripts\generate_training_data.py", line 47, in generate_graph_seq2seq_io_data x_t = data[t + x_offsets, ...] MemoryError