diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-10-27 22:13:54 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-10-27 22:13:54 +0200 |
commit | fb90a53b1235fd836dee74452f3f2a621e0f363a (patch) | |
tree | daae44aa5e7c1309a41a059594ce0c3fc92cbc26 /text_recognizer | |
parent | 8c7a59d58e2ce6b18384c9fcdba2fd49e5450b0e (diff) |
Rename transformer embeddings
Diffstat (limited to 'text_recognizer')
-rw-r--r-- | text_recognizer/networks/transformer/attention.py | 4 | ||||
-rw-r--r-- | text_recognizer/networks/transformer/embeddings/__init__.py | 1 | ||||
-rw-r--r-- | text_recognizer/networks/transformer/embeddings/absolute.py (renamed from text_recognizer/networks/transformer/positional_encodings/absolute_embedding.py) | 0 | ||||
-rw-r--r-- | text_recognizer/networks/transformer/embeddings/fourier.py (renamed from text_recognizer/networks/transformer/positional_encodings/positional_encoding.py) | 0 | ||||
-rw-r--r-- | text_recognizer/networks/transformer/embeddings/rotary.py (renamed from text_recognizer/networks/transformer/positional_encodings/rotary_embedding.py) | 0 | ||||
-rw-r--r-- | text_recognizer/networks/transformer/layers.py | 4 | ||||
-rw-r--r-- | text_recognizer/networks/transformer/positional_encodings/__init__.py | 8 |
7 files changed, 3 insertions, 14 deletions
diff --git a/text_recognizer/networks/transformer/attention.py b/text_recognizer/networks/transformer/attention.py index e098b63..3d2ece1 100644 --- a/text_recognizer/networks/transformer/attention.py +++ b/text_recognizer/networks/transformer/attention.py @@ -10,9 +10,7 @@ from torch import nn from torch import Tensor import torch.nn.functional as F -from text_recognizer.networks.transformer.positional_encodings.rotary_embedding import ( - apply_rotary_pos_emb, -) +from text_recognizer.networks.transformer.embeddings.rotary import apply_rotary_pos_emb @attr.s(eq=False) diff --git a/text_recognizer/networks/transformer/embeddings/__init__.py b/text_recognizer/networks/transformer/embeddings/__init__.py new file mode 100644 index 0000000..bb3f904 --- /dev/null +++ b/text_recognizer/networks/transformer/embeddings/__init__.py @@ -0,0 +1 @@ +"""Positional encodings for transformers.""" diff --git a/text_recognizer/networks/transformer/positional_encodings/absolute_embedding.py b/text_recognizer/networks/transformer/embeddings/absolute.py index 7140537..7140537 100644 --- a/text_recognizer/networks/transformer/positional_encodings/absolute_embedding.py +++ b/text_recognizer/networks/transformer/embeddings/absolute.py diff --git a/text_recognizer/networks/transformer/positional_encodings/positional_encoding.py b/text_recognizer/networks/transformer/embeddings/fourier.py index c50afc3..c50afc3 100644 --- a/text_recognizer/networks/transformer/positional_encodings/positional_encoding.py +++ b/text_recognizer/networks/transformer/embeddings/fourier.py diff --git a/text_recognizer/networks/transformer/positional_encodings/rotary_embedding.py b/text_recognizer/networks/transformer/embeddings/rotary.py index 2f58964..2f58964 100644 --- a/text_recognizer/networks/transformer/positional_encodings/rotary_embedding.py +++ b/text_recognizer/networks/transformer/embeddings/rotary.py diff --git a/text_recognizer/networks/transformer/layers.py b/text_recognizer/networks/transformer/layers.py index 70a0ac7..2b8427d 100644 --- a/text_recognizer/networks/transformer/layers.py +++ b/text_recognizer/networks/transformer/layers.py @@ -4,10 +4,8 @@ from typing import Any, Dict, Optional, Tuple import attr from torch import nn, Tensor +from text_recognizer.networks.transformer.embeddings.rotary import RotaryEmbedding from text_recognizer.networks.transformer.residual import Residual -from text_recognizer.networks.transformer.positional_encodings.rotary_embedding import ( - RotaryEmbedding, -) from text_recognizer.networks.util import load_partial_fn diff --git a/text_recognizer/networks/transformer/positional_encodings/__init__.py b/text_recognizer/networks/transformer/positional_encodings/__init__.py deleted file mode 100644 index 2ed8a12..0000000 --- a/text_recognizer/networks/transformer/positional_encodings/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -"""Positional encoding for transformers.""" -from .absolute_embedding import AbsolutePositionalEmbedding -from .positional_encoding import ( - PositionalEncoding, - PositionalEncoding2D, - target_padding_mask, -) -from .rotary_embedding import apply_rotary_pos_emb, RotaryEmbedding |