Skip to content

Instantly share code, notes, and snippets.

@awni
Last active July 6, 2025 16:31
Show Gist options
  • Save awni/773e2a12079da40a1cbc566686c84c8f to your computer and use it in GitHub Desktop.
Save awni/773e2a12079da40a1cbc566686c84c8f to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@teh-m4rt14n
Copy link

Downloaded and ran your notebook:

When calling the train() function from mlx_lm.tuner.trainer, it passes a tokenizer argument, which led to the following error:

TypeError: train() got an unexpected keyword argument 'tokenizer'

Checked the function signature using help(train):

Help on function train in module mlx_lm.tuner.trainer:

train(
model,
optimizer,
train_dataset,
val_dataset,
args: mlx_lm.tuner.trainer.TrainingArgs = TrainingArgs(...),
loss: callable = default_loss,
iterate_batches: callable = iterate_batches,
training_callback: TrainingCallback = None
)

It states that tokenizer is not a valid argument...but if you remove it then it cascades into another error.

@crack93
Copy link

crack93 commented Jul 6, 2025

remove the tokenizer from there and use train_dataset=CacheDataset(ds_train),
val_dataset=CacheDataset(ds_valid),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment