Skip to content

Support Llama 3.2 1B instruct#319

Open
LYZJU2019 wants to merge 3 commits intooxiglade:mainfrom
LYZJU2019:lyzju2019/support-llama
Open

Support Llama 3.2 1B instruct#319
LYZJU2019 wants to merge 3 commits intooxiglade:mainfrom
LYZJU2019:lyzju2019/support-llama

Conversation

@LYZJU2019
Copy link
Contributor

@LYZJU2019 LYZJU2019 commented Feb 16, 2026

This PR attempts to support meta-llama/Llama-3.2-1B-Instruct

Reference implementation: https://github.com/ml-explore/mlx-examples/blob/main/llms/llama/llama.py

To test, run hf download meta-llama/Llama-3.2-1B-Instruct and the model folder should appear in ~/.cache/huggingface/hub/models--meta-llama--Llama-3.2-1B-Instruct/snapshots/<commit_hash>

@minghuaw minghuaw self-requested a review March 2, 2026 00:38
}
}

impl mlx_rs::module::ModuleParameters for Llama3Rope {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be derived

}
}

let freqs_array = Array::from_slice(&scaled_freqs, &[half_dims]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of converting to mlx array at the end, it might be better to start using mlx ops from the beginning

Llama3(Llama3Rope),
}

impl mlx_rs::module::ModuleParameters for RopeVariant {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: support derive ModuleParameters for enum

}
}

fn get_float_from_config(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str variant aren't just float point numbers in string format, there could be values like "default" and "linear" for example.

@LYZJU2019 LYZJU2019 force-pushed the lyzju2019/support-llama branch from c591a5d to 6c4016c Compare March 2, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants