pip install flask
pip install torch
Open a new terminal window at the base folder team11 and execute:
cd python
flask --app Api_server run
Open a new terminal window at the base folder team11 and execute:
./gradlew run
If ./gradlew is not working, use this fix: https://stackoverflow.com/questions/41700798/error-message-gradlew-command-not-found
Please go to the Run_Small_RNN.py file in the RNN folder. From here the main method can be run. In the terminal
you will see the request for a message. The message can be from any length as long as the text is encrypted with the
keyword newkey. The encrypted text can be any text, since the model learned the english language. Meaning words/text not
in the dataset do get decrypted correctly.
Please go to the Enigma_RNN.py file in the RNN folder. Then go down to the main method and make sure the line to run
inference is uncommented and the line for training is commented. Within the inference line specify the correct model
weights you want to run (e.g. pad_everything.pt). Then make sure to set the top variable called MAX_LENGTH_GLOBAL
is set to the right value. For the pad_everything.pt file this value should be 115. Then run the file. In the terminal
you will see the request for a message. Make sure the message is less than 115 characters long and the keyword in encrypted
form, namely hitchhikersguidetothegalaxy is in the beginning of this message. You will see the model outputs the encrypted
keyword as intended.
To extend the functionality of our model to handle longer texts and keywords positioned arbitrarily within the sentence, we need to address several challenges. Currently, the model's performance degrades when the keyword is placed at varying positions within the text, largely due to the overwhelming influence of padding tokens used during training. This results in the model learning to output padding values rather than identifying the keyword.
Future work can involve an attention mechanism to help the model attend to essential parts of the input sequence, so it can locate the keyword, no matter what its position in the sequence is. Also, redesigning a binary classification approach for output encoding—marking each character position as part of the keyword or not—could relieve the issue of padding dominance. Making the loss function such that misclassifying keyword characters is given more penalty compared to padding characters would further refine the focus of the model during training.