I'm learning these [Gregorian modes](https://en.wikipedia.org/wiki/Gregorian_mode) things and I'm trying to identify these modes in a Bach music, Invention 8 F Major, for example:

![enter image description here](https://i.stack.imgur.com/aAm2T.png)

The music starts at F in Ionian mode. But I think It changes when getting at 2, 3 and at 4. If it really changes, changes for which mode? I'm completely lost, any kind of help will be good!