97c3dff645495d9c1c7bc18641861bb95637c1ba,python/baseline/tf/classify/model.py,ClassifierModelBase,load,#Any#Any#,280

Before Change


        if __version__ != _state["version"]:
            logger.warning("Loaded model is from baseline version %s, running version is %s", _state["version"], __version__)
        _state["sess"] = kwargs.pop("sess", tf.Session())
        embeddings_info = _state.pop("embeddings")
        embeddings = reload_embeddings(embeddings_info, basename)
        // If there is a kwarg that is the same name as an embedding object that
        // is taken to be the input of that layer. This allows for passing in
        // subgraphs like from a tf.split (for data parallel) or preprocessing
        // graphs that convert text to indices
        for k in embeddings_info:
            if k in kwargs:
                _state[k] = kwargs[k]
        // TODO: convert labels into just another vocab and pass number of labels to models.
        labels = read_json("{}.labels".format(basename))
        model = cls.create(embeddings, labels, **_state)
        model._state = _state
        if kwargs.get("init", True):

After Change


        if __version__ != _state["version"]:
            logger.warning("Loaded model is from baseline version %s, running version is %s", _state["version"], __version__)
        _state["sess"] = kwargs.pop("sess", tf.Session())
        with _state["sess"].graph.as_default():
            embeddings_info = _state.pop("embeddings")
            embeddings = reload_embeddings(embeddings_info, basename)
            // If there is a kwarg that is the same name as an embedding object that
            // is taken to be the input of that layer. This allows for passing in
            // subgraphs like from a tf.split (for data parallel) or preprocessing
            // graphs that convert text to indices
            for k in embeddings_info:
                if k in kwargs:
                    _state[k] = kwargs[k]
            // TODO: convert labels into just another vocab and pass number of labels to models.
            labels = read_json("{}.labels".format(basename))
            model = cls.create(embeddings, labels, **_state)
            model._state = _state
            if kwargs.get("init", True):
                model.sess.run(tf.global_variables_initializer())
            model.saver = tf.train.Saver()
            model.saver.restore(model.sess, basename)
            return model

    @property
    def lengths_key(self):
        return self._lengths_key
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: dpressel/mead-baseline
Commit Name: 97c3dff645495d9c1c7bc18641861bb95637c1ba
Time: 2019-03-18
Author: dpressel@gmail.com
File Name: python/baseline/tf/classify/model.py
Class Name: ClassifierModelBase
Method Name: load


Project Name: p2irc/deepplantphenomics
Commit Name: 8d12411ea661a8616de84c705b575dbd9bac921a
Time: 2017-03-03
Author: jubbens@gmail.com
File Name: deepplantphenomics/deepplantpheno.py
Class Name: DPPModel
Method Name: compute_full_test_accuracy


Project Name: dpressel/mead-baseline
Commit Name: 97c3dff645495d9c1c7bc18641861bb95637c1ba
Time: 2019-03-18
Author: dpressel@gmail.com
File Name: python/baseline/tf/lm/model.py
Class Name: LanguageModelBase
Method Name: load