saltudelft / type4py

Type4Py: Deep Similarity Learning-Based Type Inference for Python
Apache License 2.0
61 stars 13 forks source link

Pre-computing triplets in `TripletDataset` #12

Open mir-am opened 2 years ago

mir-am commented 2 years ago

Before this PR, we had to compute triplets on the fly to obtain a training sample, slowing down training and making the GPU wait for data. This PR makes an improvement to TripletDataset by pre-computing triplets before training the model and giving up to 6 times faster training speed. This way, obtaining a training sample to create batches is almost instant. However, with this improvement, each anchor has only one corresponding positive and negative example in every epoch.