Dataset¶
deepke.relation_extraction.few_shot.dataset.base_data_module module¶
Base DataModule class.
- class deepke.relation_extraction.few_shot.dataset.base_data_module.BaseDataModule(args)[source]¶
Bases:
torch.nn.modules.module.Module
Base DataModule.
- get_data_config()[source]¶
Return important settings of the dataset, which will be passed to instantiate models.
- prepare_data()[source]¶
Use this method to do things that might write to disk or that need to be done only from a single GPU in distributed settings (so don’t set state self.x = y).
deepke.relation_extraction.few_shot.dataset.dialogue module¶
- class deepke.relation_extraction.few_shot.dataset.dialogue.REDataset(args)[source]¶
Bases:
deepke.relation_extraction.few_shot.dataset.base_data_module.BaseDataModule
- setup(stage=None)[source]¶
Split into train, val, test, and set dims. Should assign torch Dataset objects to self.data_train, self.data_val, and optionally self.data_test.
deepke.relation_extraction.few_shot.dataset.processor module¶
- class deepke.relation_extraction.few_shot.dataset.processor.InputExample(guid, text_a, text_b=None, label=None, text_c=None, entity=None)[source]¶
Bases:
object
A single training/test example for simple sequence classification.
- class deepke.relation_extraction.few_shot.dataset.processor.InputExampleSST2(guid, text_a, text_b=None, label=None, text_c=None, entity=None)[source]¶
Bases:
object
A single training/test example for simple sequence classification.
- class deepke.relation_extraction.few_shot.dataset.processor.InputFeaturesSST2(input_ids, attention_mask, token_type_ids, label_id)[source]¶
Bases:
object
A single set of features of data.
- class deepke.relation_extraction.few_shot.dataset.processor.InputExampleWiki80(guid, sentence, span1, span2, ner1, ner2, label)[source]¶
Bases:
object
A single training/test example for span pair classification.
- class deepke.relation_extraction.few_shot.dataset.processor.InputFeatures(input_ids, input_mask, segment_ids, label_id, entity=None)[source]¶
Bases:
object
A single set of features of data.
- class deepke.relation_extraction.few_shot.dataset.processor.DataProcessor[source]¶
Bases:
object
Base class for data converters for sequence classification data sets.
- class deepke.relation_extraction.few_shot.dataset.processor.Sst2Processor(data_dir, a)[source]¶
Bases:
deepke.relation_extraction.few_shot.dataset.processor.DataProcessor
Processor for the SST-2 data set (GLUE version).
- class deepke.relation_extraction.few_shot.dataset.processor.relossProcessor(data_path='data', use_prompt=False)[source]¶
Bases:
deepke.relation_extraction.few_shot.dataset.processor.DataProcessor
- class deepke.relation_extraction.few_shot.dataset.processor.bertProcessor(data_path='data', use_prompt=False)[source]¶
Bases:
deepke.relation_extraction.few_shot.dataset.processor.DataProcessor
- class deepke.relation_extraction.few_shot.dataset.processor.ptuneProcessor(data_path='data', use_prompt=False, ptune_k=6)[source]¶
Bases:
deepke.relation_extraction.few_shot.dataset.processor.DataProcessor
- D¶
TODO, add new samples, every sample if there is a trigger then mask trigger and replace the origin mask with right token, if no trigger in the sentence, random mask a word in the sentence and replace the origin mask with the right token.
- class deepke.relation_extraction.few_shot.dataset.processor.wiki80Processor(data_path, use_prompt)[source]¶
Bases:
deepke.relation_extraction.few_shot.dataset.processor.DataProcessor
Processor for the TACRED data set.
- deepke.relation_extraction.few_shot.dataset.processor.convert_examples_to_features_for_loss(examples, max_seq_length, tokenizer)[source]¶
- deepke.relation_extraction.few_shot.dataset.processor.convert_examples_to_features_normal(examples, max_seq_length, tokenizer)[source]¶
- deepke.relation_extraction.few_shot.dataset.processor.convert_examples_to_features(examples, max_seq_length, tokenizer, args, rel2id)[source]¶
Loads a data file into a list of `InputBatch`s.
- deepke.relation_extraction.few_shot.dataset.processor.convert_examples_to_feature_sst2(examples, max_seq_length, tokenizer, args, rel2id)[source]¶
Loads a data file into a list of `InputBatch`s.