maybe the simplest way is to create two nn.Modules, one for each part of your network. Each module is then associated with an optimizer that optimize one specific loss:
class Part1(nn.Module):
    #...
class Part2(nn.Module):
    #...
part1 = Part1(); part2 = Part2()
optim1 = torch.optim.SGD(part1, lr1)
optim2 = torch.optim.SGD(part2, lr2)

for epoch:
    input, target = next_data()
    x = part1(input)
    output = part2(x)
    loss1 = your_loss1(output, target)
    loss2 = your_loss2(output, target)
    loss1.backward()
    loss2.backward()
    optim1.step() # affect part1 to optimize loss1
    optim2.step() # affect part2 to optimize loss2