Patch for TL1 kernel generation setup on Arm64 (Mac M1 Pro).
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 40.3k
- Forks
- 3.7k
- PR merge metrics
- No merged PRs in 30d
Description
Hey all!
I am attempting to run and benchmark TL1 inference on my Mac M1 Pro device. After following the guide for the build process successfully, I ran python setup_env.py -q TL1 (after installing a pre-converted GGUF model from HuggingFace) to specify dynamic generation of TL1 kernels during inference. However, this setup process is littered with bugs. To give a few examples:
- In the hf-to-gguf conversion script, a registration decorator is applied to the general BitNet model class, but there is a mismatch in capitalisation. Currently it is:
@Model.register("BitnetForCausalLM")which I changed to@Model.register("BitNetForCausalLM"). This was a simple fix. - Further, the converter by default assumes the model uses a SentencePiece tokeniser, despite a GPT-2 style tokeniser being specified in the logs. There is no clear selection of code paths separating the appropriate tokeniser, the BitNet model class immediately uses the SentencePiece tokeniser initialisation method. I changed this temporarily to call the GPT-2 tokeniser included in the same script but this is a temporary fix.
- Furthermore, kernel configuration fails. Specifically, BM=-1. This means
kernel_config.inidoes not include a shape which conforms to the built-in M and K constants. I can add these in manually but this feels like a haphazard fix.
So, in summary:
- Am I doing something obviously wrong which is generating all these errors?
- I will attempt to patch kernel configuration, but why do the shapes not automatically conform?
- Is this a known issue for this device and/or architecture?
- Assuming this is a legitimate collection of bugs, can I submit a patch, if I am able to solve the kernel configuration problem? Otherwise, would it be possible for the team working on this framework to provide a more robust and universal solution?
This is the full log (some of the file paths have been obscured):
Traceback (most recent call last):
File "/BitNet/utils/convert-hf-to-gguf-bitnet.py", line 1175, in /BitNet/utils/convert-hf-to-gguf-bitnet.py", line 1055, in write_tensors
main()
File "BitNet/utils/convert-hf-to-gguf-bitnet.py", line 1167, in main/BitNet/utils/convert-hf-to-gguf-bitnet.py", line 200, in write
model_instance.write()
File "
self.write_tensors()
File "
data, i2_scale = transform_to_tl1(data)
^^^^^^^^^^^^^^^^^^^^^^
File "/BitNet/utils/convert-hf-to-gguf-bitnet.py", line 667, in transform_to_tl1/BitNet/utils/convert-hf-to-gguf-bitnet.py", line 509, in preprocess_weights_tl1
res = preprocess_weights_tl1(x)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "
raise NotImplementedError
NotImplementedError
Thank you!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with utils/convert-hf-to-gguf-bitnet.py, especially the model registration, tokenizer selection, preprocess_weights_tl1, and transform_to_tl1 paths shown in the traceback, then inspect setup_env.py and kernel_config.ini. Reproduce the TL1 setup on Arm64 and determine whether model conversion completes, tokenizer selection is correct, and kernel shapes avoid BM=-1 without manual edits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100