Skip to content
This repository was archived by the owner on Nov 21, 2022. It is now read-only.

enable custom transaction embedding #1

Merged
merged 3 commits into from
Oct 26, 2022
Merged
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
8 changes: 6 additions & 2 deletions entity_embed/data_utils/field_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
from importlib import import_module

from torchtext.vocab import Vocab
from torchtext.vocab import Vocab, Vectors

from .numericalizer import (
AVAILABLE_VOCABS,
Expand Down Expand Up @@ -93,7 +93,11 @@ def _parse_field_config(cls, field, field_config, record_list):
"an field name."
)
vocab = Vocab(vocab_counter)
vocab.load_vectors(vocab_type)
if vocab_type in {'tx_embeddings_large.vec','tx_embeddings.vec'}:
vectors = Vectors(vocab_type, cache='.vector_cache')
vocab.load_vectors(vectors)
else:
vocab.load_vectors(vocab_type)

# Compute max_str_len if necessary
if field_type in (FieldType.STRING, FieldType.MULTITOKEN) and (max_str_len is None):
Expand Down
1 change: 1 addition & 0 deletions entity_embed/data_utils/numericalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"glove.6B.100d",
"glove.6B.200d",
"glove.6B.300d",
"tx_embeddings_large.vec",
]


Expand Down