@Xuzzo - Weight Adjustment as Original Transformer

Co-authored-by: Fabio Peruzzo <39661245+Xuzzo@users.noreply.github.com>
This commit is contained in:
elitexp 2024-09-04 21:52:51 +05:45 committed by GitHub
parent 8d8812675e
commit 0fd03c7552
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,6 +105,16 @@ class WeightHandler:
weights = [WeightHandler._reshape_weights(k, v) for k, v in weights]
weights = WeightHandler._flatten(weights)
unflatten = tree_unflatten(weights)
for block in unflatten["transformer"]["transformer_blocks"]:
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"],
"linear2": block["ff_context"]["net"][2]
}
return unflatten, quantization_level