INNER CODE UNIT · Python

get_example_from_tensor_dict

hooshvare/parsbert · scripts/utils.py:29

    def get_example_from_tensor_dict(self, tensor_dict):
        """Gets an example from a dict with tensors."""
        return InputExample(
            tensor_dict["idx"].numpy(),
            tensor_dict["sentence"].numpy().decode("utf-8"),
            None,
            str(tensor_dict["label"].numpy()),
        )

    def get_train_examples(self, data_dir):
        """Gets a collection of :class:`InputExample` for the train set."""
        return self._create_examples(self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")

    def get_dev_examples(self, data_dir):
        """Gets a collection of :class:`InputExample` for the dev set."""
        return self._create_examples(self._read_tsv(os.path.join(data_dir, "dev.tsv")), "dev")

    def get_test_examples(self, data_dir):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…