[trainer] improve code readability (#8903)
* [trainer] improve code
This PR:
- removes redundant code
```
self.model = model if model is not None else None
```
and
```
self.model = model
```
are the same.
* separate attribute assignment from code logic - which simplifies things further.
* whitespace