fc52f79ed3dda250875b3ce9f3c241b80d643ef3,pytext/models/module.py,,create_module,#Any#,23

Before Change


    module = SHARED_MODULE_REGISTRY.get(typed_shared_module_key)
    if not module:
        if is_torchscript_load_path:
            with PathManager.open(load_path, "rb") as load_file:
                module = torch.jit.load(load_file)
        else:
            module = create_fn(module_config, *args, **kwargs)

    name = type(module).__name__

After Change


            with PathManager.open(load_path, "rb") as load_file:
                loaded_module = torch.load(load_file, map_location="cpu")

            if isinstance(loaded_module, dict):
                // Loaded module is a state dict
                module = create_fn(module_config, *args, **kwargs)
                module.load_state_dict(loaded_module)
            else:
                // Loaded module is a torchscripted module
                module = loaded_module

            name = type(module).__name__
            print(f"Loaded state of module {name} from {load_path} ...")

        else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: facebookresearch/pytext
Commit Name: fc52f79ed3dda250875b3ce9f3c241b80d643ef3
Time: 2020-07-07
Author: mikaell@fb.com
File Name: pytext/models/module.py
Class Name:
Method Name: create_module


Project Name: keras-team/keras
Commit Name: 1ee31ee45cc3386cb94bc1f5014f2687da1f63f6
Time: 2018-03-31
Author: predrag.gruevski@gmail.com
File Name: keras/models.py
Class Name:
Method Name: save_model


Project Name: reinforceio/tensorforce
Commit Name: ee950b503eeed5aca3747a4bcf2a40f624b743a0
Time: 2019-01-21
Author: alexkuhnle@t-online.de
File Name: tensorforce/core/optimizers/multi_step.py
Class Name: MultiStep
Method Name: tf_step


Project Name: facebookresearch/pytext
Commit Name: fc52f79ed3dda250875b3ce9f3c241b80d643ef3
Time: 2020-07-07
Author: mikaell@fb.com
File Name: pytext/models/module.py
Class Name:
Method Name: create_module


Project Name: keras-team/keras
Commit Name: 1ee31ee45cc3386cb94bc1f5014f2687da1f63f6
Time: 2018-03-31
Author: predrag.gruevski@gmail.com
File Name: keras/models.py
Class Name:
Method Name: load_model