doc-exports/docs/modelarts/umn/modelarts_trouble_0034.html
Lai, Weijian 6aa966a79a ModelArts UMN 24.3.0 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lai, Weijian <laiweijian4@huawei.com>
Co-committed-by: Lai, Weijian <laiweijian4@huawei.com>
2024-11-02 09:04:52 +00:00

3.1 KiB

Error Message "Network is unreachable" Displayed in Logs

Symptom

When PyTorch is used, the following error message will be displayed in logs after pretrained in torchvision.models is set to True:
'OSError: [Errno 101] Network is unreachable'

Possible Causes

For security purposes, ModelArts internal training nodes are not allowed to access the Internet.

Solution

  1. Change the pretrained value to False, download the pre-trained model, and load the path to this model.
    import torch
    import torchvision.models as models
    
    model1 = models.resnet34(pretrained=False, progress=True)
    checkpoint = '/xxx/resnet34-333f7ec4.pth'
    state_dict = torch.load(checkpoint)
    model1.load_state_dict(state_dict)
  2. Use the local PyCharm to remotely access notebook for debugging.

Summary and Suggestions

Before creating a training job, use the ModelArts development environment to debug the training code to maximally eliminate errors in code migration.