bootleg.tasks package¶
Submodules¶
bootleg.tasks.entity_gen_task module¶
Entity gen task definitions.
bootleg.tasks.ned_task module¶
NED task definitions.
- class bootleg.tasks.ned_task.DisambigLoss(normalize, temperature, entity_encoder_key)[source]¶
Bases:
object
Disambiguation loss.
- batch_cands_disambig_loss(intermediate_output_dict, Y)[source]¶
Return the entity disambiguation loss on prediction heads.
- Parameters
intermediate_output_dict – output dict from the Emmental task flor
Y – gold labels
Returns: loss
- batch_cands_disambig_output(intermediate_output_dict)[source]¶
Return the probs for a task in Emmental.
- Parameters
intermediate_output_dict – output dict from Emmental task flow
Returns: NED probabilities for candidates (B x M x K)
- bootleg.tasks.ned_task.create_task(args, use_batch_cands, len_context_tok, slice_datasets=None, entity_emb_file=None)[source]¶
Return an EmmentalTask for named entity disambiguation (NED).
- Parameters
args – args
use_batch_cands – use batch candidates for training
len_context_tok – length of the context tokenizer
slice_datasets – slice datasets used in scorer (default None)
entity_emb_file – file for pretrained entity embeddings - used for EVAL only
Returns: EmmentalTask for NED
Module contents¶
Task init.