Using the CIFAR10 dataset, for example, you can use the Grayscale transform.
import torchvision.transforms as transforms
import torchvision.datasets as datasets

trainset = datasets.CIFAR10(root='./data', train=True, download=True,
    transform=transforms.Grayscale(num_output_channels=1))

To confirm, you could call trainset[0][0].size, which gives back (32, 32) (with 1 channel). Also, you could again plot the data using:
plt.imshow(trainset[0][0], cmap=plt.cm.binary)