Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
bitsandbytes
Commits
67a12835
Commit
67a12835
authored
Nov 15, 2021
by
Robin Schmidt
Browse files
[FIX] passing of sparse in StableEmbedding
parent
037022e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
bitsandbytes/nn/modules.py
bitsandbytes/nn/modules.py
+2
-2
No files found.
bitsandbytes/nn/modules.py
View file @
67a12835
...
@@ -15,8 +15,8 @@ from bitsandbytes.optim import GlobalOptimManager
...
@@ -15,8 +15,8 @@ from bitsandbytes.optim import GlobalOptimManager
class
StableEmbedding
(
torch
.
nn
.
Embedding
):
class
StableEmbedding
(
torch
.
nn
.
Embedding
):
def
__init__
(
self
,
num_embeddings
:
int
,
embedding_dim
:
int
,
padding_idx
:
Optional
[
int
]
=
None
,
def
__init__
(
self
,
num_embeddings
:
int
,
embedding_dim
:
int
,
padding_idx
:
Optional
[
int
]
=
None
,
max_norm
:
Optional
[
float
]
=
None
,
norm_type
:
float
=
2.
,
scale_grad_by_freq
:
bool
=
False
,
max_norm
:
Optional
[
float
]
=
None
,
norm_type
:
float
=
2.
,
scale_grad_by_freq
:
bool
=
False
,
sparse
:
bool
=
Tru
e
,
_weight
:
Optional
[
Tensor
]
=
None
)
->
None
:
sparse
:
bool
=
Fals
e
,
_weight
:
Optional
[
Tensor
]
=
None
)
->
None
:
super
(
StableEmbedding
,
self
).
__init__
(
num_embeddings
,
embedding_dim
,
padding_idx
,
max_norm
,
norm_type
,
scale_grad_by_freq
,
Fal
se
,
_weight
)
super
(
StableEmbedding
,
self
).
__init__
(
num_embeddings
,
embedding_dim
,
padding_idx
,
max_norm
,
norm_type
,
scale_grad_by_freq
,
spar
se
,
_weight
)
self
.
norm
=
torch
.
nn
.
LayerNorm
(
embedding_dim
)
self
.
norm
=
torch
.
nn
.
LayerNorm
(
embedding_dim
)
GlobalOptimManager
.
get_instance
().
register_parameters
(
self
.
weight
)
GlobalOptimManager
.
get_instance
().
register_parameters
(
self
.
weight
)
GlobalOptimManager
.
get_instance
().
override_config
(
self
.
weight
,
'optim_bits'
,
32
)
GlobalOptimManager
.
get_instance
().
override_config
(
self
.
weight
,
'optim_bits'
,
32
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment