Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pytext/config/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ def create_component(component_type: ComponentType, config: Any, *args, **kwargs
try:
return cls.from_config(config, *args, **kwargs)
except TypeError as e:
raise Exception(f"Can't create component {cls}: {str(e)}")
raise e
# raise Exception(f"Can't create component {cls}: {str(e)}")


def create_data_handler(data_handler_config, *args, **kwargs):
Expand Down
10 changes: 5 additions & 5 deletions pytext/models/seq_models/seq2seq_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def arrange_model_inputs(
torch.Tensor,
torch.Tensor,
]:
src_tokens, src_lengths, _ = tensor_dict["src_seq_tokens"]
trg_tokens, trg_lengths, _ = tensor_dict["trg_seq_tokens"]
src_tokens, src_lengths = tensor_dict["src_seq_tokens"]
trg_tokens, trg_lengths = tensor_dict["trg_seq_tokens"]

def _shift_target(in_sequences, seq_lens, eos_idx, pad_idx):
shifted_sequence = GetTensor(
Expand Down Expand Up @@ -136,7 +136,7 @@ def _shift_target(in_sequences, seq_lens, eos_idx, pad_idx):
)

def arrange_targets(self, tensor_dict):
trg_tokens, trg_lengths, _ = tensor_dict["trg_seq_tokens"]
trg_tokens, trg_lengths = tensor_dict["trg_seq_tokens"]
return (trg_tokens, trg_lengths)

def __init__(
Expand Down Expand Up @@ -196,7 +196,7 @@ def forward(
):
additional_features: List[List[torch.Tensor]] = []

if dict_feats:
if dict_feats is not None:
additional_features.append(list(dict_feats))

if contextual_token_embedding is not None:
Expand All @@ -206,7 +206,7 @@ def forward(
src_tokens, additional_features, src_lengths, trg_tokens
)

if dict_feats:
if dict_feats is not None:
(
output_dict["dict_tokens"],
output_dict["dict_weights"],
Expand Down