Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmeda14960 committed Feb 15, 2024
1 parent 0798508 commit 562f7fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/levanter/main/train_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ def compute_loss(model: LmHeadModel, example: LmExample, key=None):
train_dataset = CausalLmDataset(
config.data.train_set(Pos.size), Pos, KeyPos, ignore_index=config.data.ignore_token_id
)
alpha = 0.3

def add_floats(x, y):
alpha = 0.3
if is_inexact_arrayish(x) and is_inexact_arrayish(y):
# linearly interpolate between the two models
return x * (1 - alpha) + y * alpha
Expand Down Expand Up @@ -149,7 +149,7 @@ def add_floats(x, y):
model_2 = named_jit(trainer.mp.cast_to_param, parameter_axis_mapping)(model_2)

# what is the f here?
logger.info(f"Interpolating between the two models with alpha={add_floats.alpha}")
logger.info(f"Interpolating between the two models with alpha={alpha}")
merged_model = jax.tree_util.tree_map(add_floats, model, model_2)
state = dataclasses.replace(state, model=merged_model)
else:
Expand Down

0 comments on commit 562f7fd

Please sign in to comment.