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
f5113baf
Commit
f5113baf
authored
Dec 14, 2022
by
zhuww
Browse files
add the func of parsing _ptm model
parent
5a7db20f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
fastfold/utils/import_weights.py
fastfold/utils/import_weights.py
+15
-17
No files found.
fastfold/utils/import_weights.py
View file @
f5113baf
...
@@ -126,8 +126,11 @@ def assign(translation_dict, orig_weights):
...
@@ -126,8 +126,11 @@ def assign(translation_dict, orig_weights):
print
(
ref
[
0
].
shape
)
print
(
ref
[
0
].
shape
)
print
(
weights
[
0
].
shape
)
print
(
weights
[
0
].
shape
)
raise
raise
def
get_translation_dict
(
model
,
is_multimer
:
bool
=
False
):
def
import_jax_weights_
(
model
,
npz_path
,
version
=
"model_1"
,
is_multimer
:
bool
=
False
):
data
=
np
.
load
(
npz_path
)
# translations = get_translation_dict(model, is_multimer=("multimer" in version))
#######################
#######################
# Some templates
# Some templates
#######################
#######################
...
@@ -537,23 +540,16 @@ def get_translation_dict(model, is_multimer: bool = False):
...
@@ -537,23 +540,16 @@ def get_translation_dict(model, is_multimer: bool = False):
},
},
}
}
return
translations
# 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"
,
"model_5"
,
"model_5"
,
"model_3_ptm"
,
"model_3_ptm"
,
"model_4_ptm"
,
"model_4_ptm"
,
"model_5_ptm"
,
"model_5_ptm"
,
]
]
if
version
in
no_templ
:
if
version
in
no_templ
:
evo_dict
=
translations
[
"evoformer"
]
evo_dict
=
translations
[
"evoformer"
]
keys
=
list
(
evo_dict
.
keys
())
keys
=
list
(
evo_dict
.
keys
())
...
@@ -582,3 +578,5 @@ def import_jax_weights_(model, npz_path, version="model_1"):
...
@@ -582,3 +578,5 @@ def import_jax_weights_(model, npz_path, version="model_1"):
# Set weights
# Set weights
assign
(
flat
,
data
)
assign
(
flat
,
data
)
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