Skip to content

Commit 5a1eb44

Browse files
authored
Skip word embedding init when enable linear embedding skip init (Oneflow-Inc#483)
* skip init in VocabEmbedding when enable ONEFLOW_LINEAR_EMBEDDING_SKIP_INIT * add .gitignore * revert version.py gitignore
1 parent d5a222e commit 5a1eb44

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
__pycache__/
44
*.py[cod]
55
*$py.class
6+
libai/config/configs
67

78
# C extensions
89
*.so

libai/layers/embedding.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ def __init__(
148148
)
149149
)
150150
# Initialize the word embedding
151-
self.init_method(self.weight)
151+
if os.getenv("ONEFLOW_LINEAR_EMBEDDING_SKIP_INIT", "0") != "1":
152+
self.init_method(self.weight)
152153
# FIXME(Lxy): Fill padding_idx is not supported in nd_sbp right now.
153154
# self._fill_padding_idx_with_zero()
154155

0 commit comments

Comments
 (0)