You could get the device from your self.lstm1:
class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
        self.lstm1 = nn.LSTM(300, 1024, num_layers=1)
        
    def forward(self, x):
        x = self.get_embedding(x)
        return x
        
    def get_embedding(self, x):
        device = 'cpu'
        if next(self.lstm1.parameters()).is_cuda:
            device = 'cuda:' + str(next(self.lstm1.parameters()).get_device())
        print('Using device: {}'.format(device))
        hidden = (torch.randn(1, 1, 1024).to(device),
                  torch.randn(1, 1, 1024).to(device))
        for w_embed in x:
            self.lstm1.flatten_parameters()
            out, hidden = self.lstm1(w_embed.detach().view(1, 1, 300).to(device), hidden)
        return out


model = MyModel()
model = model.to(0)
model = nn.DataParallel(model, device_ids=[0, 1])

x = torch.randn(2, 300)
output = model(x)
print(output)