lee-ny / teaching_arithmetic

MIT License
71 stars 19 forks source link

About the use of customized arithmetic data #4

Open Alexwangziyu opened 5 months ago

Alexwangziyu commented 5 months ago

I nothiced during training and evaluation, the code just calculates c by reading a and b. for example I use "10 + 1 = 10" to train and test the model, for training the generate_data_str() function in evaluate_addition_batch() will return "10+1=10", which is good. But for testing, generate_data_str() function will only return "10+1=" and then get_abc_new() will be called to parse the "10+1=".

Cause "10+1=" does not contain c, get_abc_new() actually use int(a)+int(b) to calculate c, which is different with my test data!

If I want to define a new arithmetic, I need to modify the code, right? I'm really hoping to get some help from the authors because I've spent hours modifying train_util.py, but I'm still not sure if I have modified it correctly.

I'd appreciate it if you could give me some guidance. Thank you so much! (I'm only working on plain and reverse)

Alexwangziyu commented 5 months ago

Updated: by modifing get_abc_new() and get_abc() I seems to be able to define my own operations, by calculating c in those two functions.