acmattson3 / handwriting-data

A way to gather and provision handwriting data for various uses.
MIT License
8 stars 1 forks source link

Numpy arrays have no data after running prepare_data.py #1

Closed DrakeHooks closed 10 months ago

DrakeHooks commented 10 months ago

Hello and thank you for this awesome program!

I am trying to take JSON files and run prepare_data.py to convert them to numpy arrays, but they always become empty files. My goal is to run this program and use it for training a model for the handwriting synthesis by Sean Vasquez. I am not super familiar with numpy, but all of my dependencies are the same version as listed in requirements.txt. Any help on this is greatly appreciated! Thanks.

files

acmattson3 commented 10 months ago

Hello! Glad you are making use of my project.

How many prompts did you complete to generate your data? This could just be caused by too little data. If not, I'll need some way to reproduce the issue to fix it, so if you can show off your handwriting JSON data too that would be helpful.

On Wed, Dec 27, 2023, 12:33 AM DrakeHooks @.***> wrote:

Hello and thank you for this awesome program!

I am trying to take JSON files and run prepare_data.py to convert them to numpy arrays, but they always become empty files. My goal is to run this program and use it for training a model for the handwriting synthesis by Sean Vasquez. I am not super familiar with numpy, but all of my dependencies are the same version as listed in requirements.txt. Any help on this is greatly appreciated! Thanks.

files.png (view on web) https://github.com/acmattson3/handwriting-data/assets/52050841/811ccbdc-8778-4741-ab85-2ba773e96430

— Reply to this email directly, view it on GitHub https://github.com/acmattson3/handwriting-data/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/A22PHG7Q2JOE7WUY73VXXY3YLPTQHAVCNFSM6AAAAABBEEWQ5GVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2TOMJTHA2TGNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

DrakeHooks commented 10 months ago

Hey! I got part of the issue above resolved by editing the paths. However, when i go to run my numpy arrays through rnn.py, I am getting this error for zero size array and that the train size is 0. Is this just a result of too little data? I only did about 10 JSON files before preparing the data. Thanks for all the help!

train size 0 val size 1 test size 1

new run with parameters: {'attention_mixture_components': 10, 'batch_size': 32, 'batch_sizes': [32, 64, 64], 'beta1_decay': 0.9, 'beta1_decays': [0.9, 0.9, 0.9], 'checkpoint_dir': 'checkpoints', 'early_stopping_steps': 1500, 'enable_parameter_averaging': False, 'grad_clip': 10, 'keep_prob_scalar': 1.0, 'learning_rate': 0.0001, 'learning_rates': [0.0001, 5e-05, 2e-05], 'log_dir': 'logs', 'log_interval': 20, 'logging_level': 20, 'loss_averaging_window': 100, 'lstm_size': 400, 'min_steps_to_checkpoint': 2000, 'num_restarts': 2, 'num_training_steps': 100000, 'optimizer': 'rms', 'output_mixture_components': 20, 'output_units': 121, 'patiences': [1500, 1000, 500], 'prediction_dir': 'predictions', 'reader': <main.DataReader object at 0x00000157C34334E0>, 'regularization_constant': 0.0, 'restart_idx': 0, 'validation_batch_size': 32, 'warm_start_init_step': 0} all parameters: [('Variable:0', []), ('Variable_1:0', []), ('Variable_2:0', []), ('rnn/LSTMAttentionCell/lstm_cell/kernel:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias:0', [1600]), ('rnn/gmm/weights:0', [400, 121]), ('rnn/gmm/biases:0', [121]), ('rnn/LSTMAttentionCell/lstm_cell/kernel/RMSProp:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/kernel/RMSProp_1:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias/RMSProp_1:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights/RMSProp:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/weights/RMSProp_1:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases/RMSProp:0', [30]), ('rnn/LSTMAttentionCell/attention/biases/RMSProp_1:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel/RMSProp:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel/RMSProp_1:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias/RMSProp_1:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel/RMSProp:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel/RMSProp_1:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias/RMSProp_1:0', [1600]), ('rnn/gmm/weights/RMSProp:0', [400, 121]), ('rnn/gmm/weights/RMSProp_1:0', [400, 121]), ('rnn/gmm/biases/RMSProp:0', [121]), ('rnn/gmm/biases/RMSProp_1:0', [121])] trainable parameters: [('rnn/LSTMAttentionCell/lstm_cell/kernel:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias:0', [1600]), ('rnn/gmm/weights:0', [400, 121]), ('rnn/gmm/biases:0', [121])] trainable parameter count: 3632431 2023-12-27 18:29:15.528539: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 built graph Traceback (most recent call last): File "c:/Users/fishh/Downloads/handwriting-synthesis-master/handwriting-synthesis-master/rnn.py", line 246, in nn.fit() File "c:\Users\fishh\Downloads\handwriting-synthesis-master\handwriting-synthesis-master\tf_base_model.py", line 134, in fit train_batch_df = next(train_generator) File "c:/Users/fishh/Downloads/handwriting-synthesis-master/handwriting-synthesis-master/rnn.py", line 65, in batch_generator max_x_len = np.max(batch['x_len']) File "<__array_function__ internals>", line 6, in amax File "C:\Users\fishh\miniconda3\envs\myenv\lib\site-packages\numpy\core\fromnumeric.py", line 2621, in amax keepdims=keepdims, initial=initial, where=where) File "C:\Users\fishh\miniconda3\envs\myenv\lib\site-packages\numpy\core\fromnumeric.py", line 90, in _wrapreduction return ufunc.reduce(obj, axis, dtype, out, **passkwargs) ValueError: zero-size array to reduction operation maximum which has no identity

acmattson3 commented 10 months ago

I used 70 prompts for my first attempt and that worked. 10 prompts doesn't sound like nearly enough data. The original handwriting synthesis AI used multiple hundreds of megabytes of data, and even 70 prompts is only a couple megabytes. Hence how I got the crap results. In short you'll want a lot more data. Make sure you modified the original AI code as described in the readme in the prompts directory, too, as one of those modifications fixes a "too little data" error.

If you want to download some of mine to test, I left instructions at the bottom of the readme on how to download that data using mongoDB compass.

On Wed, Dec 27, 2023, 2:32 PM DrakeHooks @.***> wrote:

Hey! I got part of the issue above resolved by editing the paths. However, when i go to run my numpy arrays through rnn.py, I am getting this error for zero size array and that the train size is 0. Is this just a result of too little data? I only did about 10 JSON files before preparing the data. Thanks for all the help!

train size 0 val size 1 test size 1

new run with parameters: {'attention_mixture_components': 10, 'batch_size': 32, 'batch_sizes': [32, 64, 64], 'beta1_decay': 0.9, 'beta1_decays': [0.9, 0.9, 0.9], 'checkpoint_dir': 'checkpoints', 'early_stopping_steps': 1500, 'enable_parameter_averaging': False, 'grad_clip': 10, 'keep_prob_scalar': 1.0, 'learning_rate': 0.0001, 'learning_rates': [0.0001, 5e-05, 2e-05], 'log_dir': 'logs', 'log_interval': 20, 'logging_level': 20, 'loss_averaging_window': 100, 'lstm_size': 400, 'min_steps_to_checkpoint': 2000, 'num_restarts': 2, 'num_training_steps': 100000, 'optimizer': 'rms', 'output_mixture_components': 20, 'output_units': 121, 'patiences': [1500, 1000, 500], 'prediction_dir': 'predictions', 'reader': <main.DataReader object at 0x00000157C34334E0>, 'regularization_constant': 0.0, 'restart_idx': 0, 'validation_batch_size': 32, 'warm_start_init_step': 0} all parameters: [('Variable:0', []), ('Variable_1:0', []), ('Variable_2:0', []), ('rnn/LSTMAttentionCell/lstm_cell/kernel:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias:0', [1600]), ('rnn/gmm/weights:0', [400, 121]), ('rnn/gmm/biases:0', [121]), ('rnn/LSTMAttentionCell/lstm_cell/kernel/RMSProp:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/kernel/RMSProp_1:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias/RMSProp_1:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights/RMSProp:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/weights/RMSProp_1:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases/RMSProp:0', [30]), ('rnn/LSTMAttentionCell/attention/biases/RMSProp_1:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel/RMSProp:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel/RMSProp_1:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias/RMSProp_1:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel/RMSProp:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel/RMSProp_1:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias/RMSProp_1:0', [1600]), ('rnn/gmm/weights/RMSProp:0', [400, 121]), ('rnn/gmm/weights/RMSProp_1:0', [400, 121]), ('rnn/gmm/biases/RMSProp:0', [121]), ('rnn/gmm/biases/RMSProp_1:0', [121])] trainable parameters: [('rnn/LSTMAttentionCell/lstm_cell/kernel:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias:0', [1600]), ('rnn/gmm/weights:0', [400, 121]), ('rnn/gmm/biases:0', [121])] trainable parameter count: 3632431 2023-12-27 18:29:15.528539: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 built graph Traceback (most recent call last): File "c:/Users/fishh/Downloads/handwriting-synthesis-master/handwriting-synthesis-master/rnn.py", line 246, in nn.fit() File "c:\Users\fishh\Downloads\handwriting-synthesis-master\handwriting-synthesis-master\tf_base_model.py", line 134, in fit train_batch_df = next(train_generator) File "c:/Users/fishh/Downloads/handwriting-synthesis-master/handwriting-synthesis-master/rnn.py", line 65, in batch_generator max_x_len = np.max(batch['x_len']) File "<array_function internals>", line 6, in amax File "C:\Users\fishh\miniconda3\envs\myenv\lib\site-packages\numpy\core\fromnumeric.py", line 2621, in amax keepdims=keepdims, initial=initial, where=where) File "C:\Users\fishh\miniconda3\envs\myenv\lib\site-packages\numpy\core\fromnumeric.py", line 90, in _wrapreduction return ufunc.reduce(obj, axis, dtype, out, **passkwargs) ValueError: zero-size array to reduction operation maximum which has no identity

— Reply to this email directly, view it on GitHub https://github.com/acmattson3/handwriting-data/issues/1#issuecomment-1870691352, or unsubscribe https://github.com/notifications/unsubscribe-auth/A22PHGYTG7T7DFIJOITPOYLYLSVZFAVCNFSM6AAAAABBEEWQ5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZQGY4TCMZVGI . You are receiving this because you commented.Message ID: @.***>

DrakeHooks commented 10 months ago

I used 70 prompts for my first attempt and that worked. 10 prompts doesn't sound like nearly enough data. The original handwriting synthesis AI used multiple hundreds of megabytes of data, and even 70 prompts is only a couple megabytes. Hence how I got the crap results. In short you'll want a lot more data. Make sure you modified the original AI code as described in the readme in the prompts directory, too, as one of those modifications fixes a "too little data" error. If you want to download some of mine to test, I left instructions at the bottom of the readme on how to download that data using mongoDB compass. On Wed, Dec 27, 2023, 2:32 PM DrakeHooks @.> wrote: Hey! I got part of the issue above resolved by editing the paths. However, when i go to run my numpy arrays through rnn.py, I am getting this error for zero size array and that the train size is 0. Is this just a result of too little data? I only did about 10 JSON files before preparing the data. Thanks for all the help! train size 0 val size 1 test size 1 new run with parameters: {'attention_mixture_components': 10, 'batch_size': 32, 'batch_sizes': [32, 64, 64], 'beta1_decay': 0.9, 'beta1_decays': [0.9, 0.9, 0.9], 'checkpoint_dir': 'checkpoints', 'early_stopping_steps': 1500, 'enable_parameter_averaging': False, 'grad_clip': 10, 'keep_prob_scalar': 1.0, 'learning_rate': 0.0001, 'learning_rates': [0.0001, 5e-05, 2e-05], 'log_dir': 'logs', 'log_interval': 20, 'logging_level': 20, 'loss_averaging_window': 100, 'lstm_size': 400, 'min_steps_to_checkpoint': 2000, 'num_restarts': 2, 'num_training_steps': 100000, 'optimizer': 'rms', 'output_mixture_components': 20, 'output_units': 121, 'patiences': [1500, 1000, 500], 'prediction_dir': 'predictions', 'reader': <main.DataReader object at 0x00000157C34334E0>, 'regularization_constant': 0.0, 'restart_idx': 0, 'validation_batch_size': 32, 'warm_start_init_step': 0} all parameters: [('Variable:0', []), ('Variable_1:0', []), ('Variable_2:0', []), ('rnn/LSTMAttentionCell/lstm_cell/kernel:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias:0', [1600]), ('rnn/gmm/weights:0', [400, 121]), ('rnn/gmm/biases:0', [121]), ('rnn/LSTMAttentionCell/lstm_cell/kernel/RMSProp:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/kernel/RMSProp_1:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias/RMSProp_1:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights/RMSProp:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/weights/RMSProp_1:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases/RMSProp:0', [30]), ('rnn/LSTMAttentionCell/attention/biases/RMSProp_1:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel/RMSProp:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel/RMSProp_1:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias/RMSProp_1:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel/RMSProp:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel/RMSProp_1:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias/RMSProp_1:0', [1600]), ('rnn/gmm/weights/RMSProp:0', [400, 121]), ('rnn/gmm/weights/RMSProp_1:0', [400, 121]), ('rnn/gmm/biases/RMSProp:0', [121]), ('rnn/gmm/biases/RMSProp_1:0', [121])] trainable parameters: [('rnn/LSTMAttentionCell/lstm_cell/kernel:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias:0', [1600]), ('rnn/gmm/weights:0', [400, 121]), ('rnn/gmm/biases:0', [121])] trainable parameter count: 3632431 2023-12-27 18:29:15.528539: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 built graph Traceback (most recent call last): File "c:/Users/fishh/Downloads/handwriting-synthesis-master/handwriting-synthesis-master/rnn.py", line 246, in nn.fit() File "c:\Users\fishh\Downloads\handwriting-synthesis-master\handwriting-synthesis-master\tf_base_model.py", line 134, in fit train_batch_df = next(train_generator) File "c:/Users/fishh/Downloads/handwriting-synthesis-master/handwriting-synthesis-master/rnn.py", line 65, in batch_generator max_x_len = np.max(batch['x_len']) File "<array_function* internals>", line 6, in amax File "C:\Users\fishh\miniconda3\envs\myenv\lib\site-packages\numpy\core\fromnumeric.py", line 2621, in amax keepdims=keepdims, initial=initial, where=where) File "C:\Users\fishh\miniconda3\envs\myenv\lib\site-packages\numpy\core\fromnumeric.py", line 90, in _wrapreduction return ufunc.reduce(obj, axis, dtype, out, *passkwargs) ValueError: zero-size array to reduction operation maximum which has no identity — Reply to this email directly, view it on GitHub <#1 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A22PHGYTG7T7DFIJOITPOYLYLSVZFAVCNFSM6AAAAABBEEWQ5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZQGY4TCMZVGI . You are receiving this because you commented.Message ID: @.>

I see. I just added more data and it looks like the train size is now 1. I still get the StopIteration error with 20 prompts but hopefully that will stop when I add significantly more data. I have made sure to modify data_frame.py and tf_base_model.py and I will make an effort to download your data to test later tonight! Thanks again for all the help and clarification.

DrakeHooks commented 10 months ago

@acmattson3 Hey! Just reporting back after trying to download the dataset on MongoDB Compass. MongoDB compass wants to download everything into one .JSON file so I was unable to get it downloaded locally. I noticed that your .JSON files have an ObjectId and mine only have one "id" and "writer_id" . I'm not sure if this is causing any issues for training but it is just an observation. I'm at 75 prompts completed and I still get StopIteration after running rnn.py . I will keep working on prompts to see if it still needs more data.

acmattson3 commented 10 months ago

@acmattson3 Hey! Just reporting back after trying to download the dataset on MongoDB Compass. MongoDB compass wants to download everything into one .JSON file so I was unable to get it downloaded locally. I noticed that your .JSON files have an ObjectId and mine only have one "id" and "writer_id" . I'm not sure if this is causing any issues for training but it is just an observation. I'm at 75 prompts completed and I still get StopIteration after running rnn.py . I will keep working on prompts to see if it still needs more data.

The StopIteration problem is an issue in the handwriting synthesis AI. I may have made a change to the files that I didn't put in the readme, or you might have missed one of the changes I made. I will check if I missed anything.

acmattson3 commented 10 months ago

@acmattson3 Hey! Just reporting back after trying to download the dataset on MongoDB Compass. MongoDB compass wants to download everything into one .JSON file so I was unable to get it downloaded locally. I noticed that your .JSON files have an ObjectId and mine only have one "id" and "writer_id" . I'm not sure if this is causing any issues for training but it is just an observation. I'm at 75 prompts completed and I still get StopIteration after running rnn.py . I will keep working on prompts to see if it still needs more data.

I found one more difference that is probably causing the issue. In my rnn.py file, in the if __name__=="__main__"": section, here is my code:

dr = DataReader(data_dir='data/processed/')

    nn = rnn(
        reader=dr,
        log_dir='logs',
        checkpoint_dir='checkpoints',
        prediction_dir='predictions',
        #learning_rates=[.0001, .00005, .00002],
        learning_rates=[.001, .0005, .0002],
        #batch_sizes=[32, 64, 64],
        batch_sizes=[8, 16, 16],
        #patiences=[1500, 1000, 500],
        patiences=[1000, 500, 250],
        beta1_decays=[.9, .9, .9],
        validation_batch_size=32,
        optimizer='rms',
        #num_training_steps=100000,
        num_training_steps=2500,
        warm_start_init_step=0,
        regularization_constant=0.0,
        keep_prob=1.0,
        enable_parameter_averaging=False,
        #min_steps_to_checkpoint=2000,
        min_steps_to_checkpoint=1000,
        log_interval=20,
        grad_clip=10,
        lstm_size=400,
        output_mixture_components=20,
        attention_mixture_components=10
    )
    nn.fit()

Those commented-out lines are probably the trick.

DrakeHooks commented 10 months ago

@acmattson3 Just made those changes and it looks like it is training. This is only 83 prompts completed of my own data and I think that is why it still does a StopIteration.

train size 10 val size 1 test size 11

new run with parameters: {'attention_mixture_components': 10, 'batch_size': 8, 'batch_sizes': [8, 16, 16], 'beta1_decay': 0.9, 'beta1_decays': [0.9, 0.9, 0.9], 'checkpoint_dir': 'checkpoints', 'early_stopping_steps': 1000, 'enable_parameter_averaging': False, 'grad_clip': 10, 'keep_prob_scalar': 1.0, 'learning_rate': 0.001, 'learning_rates': [0.001, 0.0005, 0.0002], 'log_dir': 'logs', 'log_interval': 20, 'logging_level': 20, 'loss_averaging_window': 100, 'lstm_size': 400, 'min_steps_to_checkpoint': 1000, 'num_restarts': 2, 'num_training_steps': 2500, 'optimizer': 'rms', 'output_mixture_components': 20, 'output_units': 121, 'patiences': [1000, 500, 250], 'prediction_dir': 'predictions', 'reader': <main.DataReader object at 0x00000276021A34E0>, 'regularization_constant': 0.0, 'restart_idx': 0, 'validation_batch_size': 32, 'warm_start_init_step': 0} all parameters: [('Variable:0', []), ('Variable_1:0', []), ('Variable_2:0', []), ('rnn/LSTMAttentionCell/lstm_cell/kernel:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias:0', [1600]), ('rnn/gmm/weights:0', [400, 121]), ('rnn/gmm/biases:0', [121]), ('rnn/LSTMAttentionCell/lstm_cell/kernel/RMSProp:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/kernel/RMSProp_1:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias/RMSProp_1:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights/RMSProp:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/weights/RMSProp_1:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases/RMSProp:0', [30]), ('rnn/LSTMAttentionCell/attention/biases/RMSProp_1:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel/RMSProp:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel/RMSProp_1:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias/RMSProp_1:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel/RMSProp:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel/RMSProp_1:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias/RMSProp:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias/RMSProp_1:0', [1600]), ('rnn/gmm/weights/RMSProp:0', [400, 121]), ('rnn/gmm/weights/RMSProp_1:0', [400, 121]), ('rnn/gmm/biases/RMSProp:0', [121]), ('rnn/gmm/biases/RMSProp_1:0', [121])] trainable parameters: [('rnn/LSTMAttentionCell/lstm_cell/kernel:0', [476, 1600]), ('rnn/LSTMAttentionCell/lstm_cell/bias:0', [1600]), ('rnn/LSTMAttentionCell/attention/weights:0', [476, 30]), ('rnn/LSTMAttentionCell/attention/biases:0', [30]), ('rnn/LSTMAttentionCell/lstm_cell_1/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_1/bias:0', [1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/kernel:0', [876, 1600]), ('rnn/LSTMAttentionCell/lstm_cell_2/bias:0', [1600]), ('rnn/gmm/weights:0', [400, 121]), ('rnn/gmm/biases:0', [121])] trainable parameter count: 3632431 2023-12-28 22:26:24.866368: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 built graph max_x: 1199 max_c: 44 max_x: 1199 max_c: 47 [[step 0]] [[train 11.7543s]] loss: 4.34547901 [[val 1.2226s]] loss: 4.18537235
Traceback (most recent call last): File "c:/Users/fishh/Downloads/handwriting-synthesis-master/handwriting-synthesis-master/rnn.py", line 251, in nn.fit() File "c:\Users\fishh\Downloads\handwriting-synthesis-master\handwriting-synthesis-master\tf_base_model.py", line 150, in fit val_batch_df = next(val_generator) StopIteration

DrakeHooks commented 10 months ago

@acmattson3 I was able to get a model trained by tweaking tf_base_model.py a bit. Do you have any instructions on how to use that model for the samples? This is what my demo.py produced with my model. usagedemo