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
FastFold
Commits
7d10334b
"src/vscode:/vscode.git/clone" did not exist on "327deaee4122b3ff7780e36d0e481c5997dbe1fa"
Unverified
Commit
7d10334b
authored
Dec 23, 2022
by
shenggan
Committed by
GitHub
Dec 23, 2022
Browse files
fix weights import function (#124)
parent
f55dca95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
fastfold/utils/import_weights.py
fastfold/utils/import_weights.py
+10
-10
No files found.
fastfold/utils/import_weights.py
View file @
7d10334b
...
@@ -127,7 +127,8 @@ def assign(translation_dict, orig_weights):
...
@@ -127,7 +127,8 @@ def assign(translation_dict, orig_weights):
print
(
weights
[
0
].
shape
)
print
(
weights
[
0
].
shape
)
raise
raise
def
get_translation_dict
(
model
,
is_multimer
:
bool
=
False
):
def
get_translation_dict
(
model
,
version
):
is_multimer
=
"multimer"
in
version
#######################
#######################
# Some templates
# Some templates
#######################
#######################
...
@@ -537,15 +538,6 @@ def get_translation_dict(model, is_multimer: bool = False):
...
@@ -537,15 +538,6 @@ def get_translation_dict(model, is_multimer: bool = False):
},
},
}
}
return
translations
def
import_jax_weights_
(
model
,
npz_path
,
version
=
"model_1"
):
data
=
np
.
load
(
npz_path
)
translations
=
get_translation_dict
(
model
,
is_multimer
=
(
"multimer"
in
version
))
no_templ
=
[
no_templ
=
[
"model_3"
,
"model_3"
,
"model_4"
,
"model_4"
,
...
@@ -566,6 +558,14 @@ def import_jax_weights_(model, npz_path, version="model_1"):
...
@@ -566,6 +558,14 @@ def import_jax_weights_(model, npz_path, version="model_1"):
"logits"
:
LinearParams
(
model
.
aux_heads
.
tm
.
linear
)
"logits"
:
LinearParams
(
model
.
aux_heads
.
tm
.
linear
)
}
}
return
translations
def
import_jax_weights_
(
model
,
npz_path
,
version
=
"model_1"
):
data
=
np
.
load
(
npz_path
)
translations
=
get_translation_dict
(
model
,
version
)
# Flatten keys and insert missing key prefixes
# Flatten keys and insert missing key prefixes
flat
=
_process_translations_dict
(
translations
)
flat
=
_process_translations_dict
(
translations
)
...
...
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