Icon

02_​Deployment_​LSTM_​Solution

02_Deployment_LSTM_Solution
Part 1: Predict the next character1. Read the trained model "ShakespeareGenerator_50epochs.zip" (TensorFlow Network Reader node)2. Apply the network to get the probability distribution for the next character (TensorFlow Network Executor) Tip: Activate the checkbox "Keep input column in output table"3. Separate the input from network output (Column Splitter) Tip: The top port should include only the input sequence in a collection cell. The bottom port should have 82 columns with double values.4. Use the "Extract predicted char" component to get the index of the character with the highest probability. Tip: Connect the bottom output port of the Column Splitter node with the component. Part 2: Generate Rap Songs or Shakespear textThe workflow below uses the model trained on Shakespeare's works. In the data folder, you can find models trained on Rap Songs and on "I Promessi Sposi" (afamous italian novel), as well as the dictionaries created during training. Update the workflow below to generate text in Rap Song style or even in italian.Tip: Read another model and the matching dictionary from the data folder. (Optional) Part 3: Extend the workflow of part 1 to predict the next 100 characters (using a recursive loop)1. Add the Recursive Loop Start node between the Create Collection Column and TensorFlow Network Executor node2. Continue with the top output port of the Column Splitter node and split the network input into multiple columns using the Split Collection Column node Tip: Activate the checkbox: Replace input column3. Use the component "Delete First Char and Rename Columns"4. Append the predicted character from the "Extract Predicted Char" component to the new sequence (Column Appender node)5. Create a collection column with the new seqeunce (Create Collection Column node) Tip: Activate the checkbox "Remove aggregated columns from table" and make sure that the name of the new column is equivalent with the column header nameof the first Create Collection Column node6. Finish the loop with a Recursive Loop End node. Tip: - Connect the output of the Extract Predicted Char component with the top input port and the output of the Create Collection Column node with the bottominput port. - Set the maximum number of iterations to 100 7. Use the component "Extract Predicted Textd" and check the generated text: Tip: - Top input port: Generated sequence - Middle input port: Input sequence in one column (e.g. output of the Row filter node with the first 100 characters) - Bottom input port: Dictionary 8. Save your generated text as csv file (CSV Writer node) Insert a starting sentence.Be creative! Select the correct dictionaryfrom the data folder.Notice that each model hasits own dictionary Select the model you want to use. Each one will conclude your sentence differently.Don't forget to usethe right dictionary Check what the model produced.Tip: increase the number of characters andproduce longer sentences (double click onthe Generate New Text component) one column,each char in single rowApply dictionaryFirst 100rowsCreate inputRead modelNode 348100 charactersseperate inputfrom network outputSplit input collectionnext characterOutput probabilityfor first characterplus input collectionOutput probabilityfor first characterplus input collectionFirst 100rowsRead modelCreate inputdictionaryApply dictionarySave generated textAppend nextcharseperate inputfrom network outputApply dictionaryFirst 100rowsCreate inputRead dictionarydictionaryRead model one column,each char in single rowRemove missing values one column,each char in single rowStart sequenceStart sequenceStart sequenceReshape Text Create CollectionColumn Cell Replacer Row Filter Create CollectionColumn TensorFlowNetwork Reader Transpose RecursiveLoop Start Column Splitter Split CollectionColumn Recursive Loop End TensorFlowNetwork Executor TensorFlowNetwork Executor Transpose Row Filter TensorFlowNetwork Reader Create CollectionColumn Table Reader Cell Replacer CSV Writer Column Appender Column Splitter Cell Replacer Row Filter Create CollectionColumn Transpose Generate New Text Table Reader ExtractPredidted Char ExtractPredicted Text Table Reader TensorFlowNetwork Reader Reshape Text Row Filter ExtractPredidted Char Delete First Charand Rename Columns ExtractPredicted Text Reshape Text Table Creator Table Creator Table Creator Part 1: Predict the next character1. Read the trained model "ShakespeareGenerator_50epochs.zip" (TensorFlow Network Reader node)2. Apply the network to get the probability distribution for the next character (TensorFlow Network Executor) Tip: Activate the checkbox "Keep input column in output table"3. Separate the input from network output (Column Splitter) Tip: The top port should include only the input sequence in a collection cell. The bottom port should have 82 columns with double values.4. Use the "Extract predicted char" component to get the index of the character with the highest probability. Tip: Connect the bottom output port of the Column Splitter node with the component. Part 2: Generate Rap Songs or Shakespear textThe workflow below uses the model trained on Shakespeare's works. In the data folder, you can find models trained on Rap Songs and on "I Promessi Sposi" (afamous italian novel), as well as the dictionaries created during training. Update the workflow below to generate text in Rap Song style or even in italian.Tip: Read another model and the matching dictionary from the data folder. (Optional) Part 3: Extend the workflow of part 1 to predict the next 100 characters (using a recursive loop)1. Add the Recursive Loop Start node between the Create Collection Column and TensorFlow Network Executor node2. Continue with the top output port of the Column Splitter node and split the network input into multiple columns using the Split Collection Column node Tip: Activate the checkbox: Replace input column3. Use the component "Delete First Char and Rename Columns"4. Append the predicted character from the "Extract Predicted Char" component to the new sequence (Column Appender node)5. Create a collection column with the new seqeunce (Create Collection Column node) Tip: Activate the checkbox "Remove aggregated columns from table" and make sure that the name of the new column is equivalent with the column header nameof the first Create Collection Column node6. Finish the loop with a Recursive Loop End node. Tip: - Connect the output of the Extract Predicted Char component with the top input port and the output of the Create Collection Column node with the bottominput port. - Set the maximum number of iterations to 100 7. Use the component "Extract Predicted Textd" and check the generated text: Tip: - Top input port: Generated sequence - Middle input port: Input sequence in one column (e.g. output of the Row filter node with the first 100 characters) - Bottom input port: Dictionary 8. Save your generated text as csv file (CSV Writer node) Insert a starting sentence.Be creative! Select the correct dictionaryfrom the data folder.Notice that each model hasits own dictionary Select the model you want to use. Each one will conclude your sentence differently.Don't forget to usethe right dictionary Check what the model produced.Tip: increase the number of characters andproduce longer sentences (double click onthe Generate New Text component) one column,each char in single rowApply dictionaryFirst 100rowsCreate inputRead modelNode 348100 charactersseperate inputfrom network outputSplit input collectionnext characterOutput probabilityfor first characterplus input collectionOutput probabilityfor first characterplus input collectionFirst 100rowsRead modelCreate inputdictionaryApply dictionarySave generated textAppend nextcharseperate inputfrom network outputApply dictionaryFirst 100rowsCreate inputRead dictionarydictionaryRead model one column,each char in single rowRemove missing values one column,each char in single rowStart sequenceStart sequenceStart sequenceReshape Text Create CollectionColumn Cell Replacer Row Filter Create CollectionColumn TensorFlowNetwork Reader Transpose RecursiveLoop Start Column Splitter Split CollectionColumn Recursive Loop End TensorFlowNetwork Executor TensorFlowNetwork Executor Transpose Row Filter TensorFlowNetwork Reader Create CollectionColumn Table Reader Cell Replacer CSV Writer Column Appender Column Splitter Cell Replacer Row Filter Create CollectionColumn Transpose Generate New Text Table Reader ExtractPredidted Char ExtractPredicted Text Table Reader TensorFlowNetwork Reader Reshape Text Row Filter ExtractPredidted Char Delete First Charand Rename Columns ExtractPredicted Text Reshape Text Table Creator Table Creator Table Creator

Nodes

Extensions

Links