Skip to content

OSError: [Errno 22] Invalid argument: #887

Open
@Feez

Description

@Feez

torch.save(transformer.state_dict(), save_model_path)

Spent 2 hours training a model for it to fail the save with error prefixed with OSError: [Errno 22] Invalid argument :(

For now I'm just adding fail-safe but I am sure it can be written cleaner

custom_save_path = save_model_path
while True:
    try:
        torch.save(transformer.state_dict(), custom_save_path)
        break
    except:
        print("Please enter new save path:")
        custom_save_path = input() 

print("\nDone, trained model saved at", custom_save_path)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions