Adjust FF block only if it exists

This commit is contained in:
filipstrand 2024-09-12 20:43:06 +02:00
parent 3739a6b914
commit 7d27f1c4c1

View File

@ -75,10 +75,11 @@ class WeightHandler:
# Reshape and process the huggingface weights
if "transformer_blocks" in weights:
for block in weights["transformer_blocks"]:
block["ff"] = {
"linear1": block["ff"]["net"][0]["proj"],
"linear2": block["ff"]["net"][2]
}
if block.get("ff") is not None:
block["ff"] = {
"linear1": block["ff"]["net"][0]["proj"],
"linear2": block["ff"]["net"][2]
}
if block.get("ff_context") is not None:
block["ff_context"] = {
"linear1": block["ff_context"]["net"][0]["proj"],