import torch


def get_device(model):
	"""
	Extract the device to run on from the model.
	:param model: The model to train.
	:return: String. The name of the device.
	"""
	if next(model.parameters()).is_cuda:
		return 'cuda:{}'.format(torch.cuda.current_device())
	else:
		return 'cpu'