I’d like to load two models in one inference script to test two datasets. The two models are both instantiated from the class Darknet (inherited from nn.Module).
When I debug the script in pycharm, I find the two models seem to share the same memory space. It’s a little strange though, so I’m not surely whether I’m doing it in a right way.
Could somebody help me please?
Here is the code:
    if model1 is None:
        device = torch_utils.select_device()

        # Initialize model
        model1 = Darknet(cfg, img_size).to(device)

        _ = load_darknet_weights(model1, weights1)

    if model2 is None:
        # Initialize model
        model2 = Darknet(cfg, img_size).to(device)

        _ = load_darknet_weights(model2, weights2)