Sometimes, as an adverb, is one word. However, if you are using 'some' to mean 'a few' and 'times' to mean occasions, they are two separate words.
'I sometimes correct people when they spell 'grammar' incorrectly. But there are some times when I don't. On these occasions, I give the person an example of the correct spelling in the hope that they will work it out for themselves.'