What's a classifier capable of predicting a variable number of classes
This is an interesting problem. What is your xtrain? I guess it boils down to a multi label problem. In a simple setup, you would train on the presence of a certain label (present or not). So for n tags/labels, you would train n+1 (1 is no label) models. 

I‘m not really in to multilabel problems, but I guess this is the way to go.