If I understand your question correctly, I think you want to calculate loss using only the generated text.
This is not handled by run_clm script.
To handle this, you can prepare the labels  such that, all the tokens will have -100 as value except the ones you want to include in loss, that way the -100 tokens will be ignored by the CrossEntropy loss function.