You can prevent mode collapse by the most commonly used technique that is to add a item to the loss function or employ Minibatch Discriminator. Here is the optimized reference below on the usage of Minibatch Discriminator:
In the code above Mini_Batch_Discriminator adds a layer to the discriminator helps in distinguishing between samples with each batch. In this way discriminator learns to detect lack of diversity, reducing model collapse in generator.