Skip to content

Commit

Permalink
skip keys not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
qihqi committed Jan 13, 2025
1 parent 140a845 commit 35d7e49
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions torchprime/experimental/torchax_models/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ def create_sharded_weights(model, mesh, sharding_map):
def create_weights(rng):
res = {}
for name, weight_meta in model.state_dict().items():
if _process_sharding_name(name) not in sharding_map:
continue
rng, subkey = jax.random.split(rng)
if len(weight_meta.shape) < 2:
res[name] = jax.random.normal(subkey, weight_meta.shape,
Expand Down

0 comments on commit 35d7e49

Please sign in to comment.