Add tips on porting LLMs from HuggingFace (#523)

* Add tips on porting LLMs from HuggingFace

* Add CONTRIBUTING.md  to mlx-examples-llms

* Refactor imports and update comment in starcoder2.py

* Update llms/mlx_lm/models/starcoder2.py

Co-authored-by: Awni Hannun <awni.hannun@gmail.com>

* nits

* nits

---------

Co-authored-by: Awni Hannun <awni.hannun@gmail.com>
Co-authored-by: Awni Hannun <awni@apple.com>
This commit is contained in:
Muhtasham Oblokulov
2024-03-06 02:43:15 +01:00
committed by GitHub
parent 3fdf85e79d
commit 5de7c2ac33
3 changed files with 42 additions and 5 deletions

View File

@@ -1,6 +1,5 @@
import math
from dataclasses import dataclass
from typing import Dict, Optional, Tuple, Union
from typing import Optional, Tuple
import mlx.core as mx
import mlx.nn as nn
@@ -158,7 +157,7 @@ class Model(nn.Module):
super().__init__()
self.model_type = args.model_type
self.model = Starcoder2Model(args)
# This is for 15B starcoder2 since it doesn't tie word embeddings
# For 15B starcoder2 and fine-tuned models which don't tie word embeddings
if not args.tie_word_embeddings:
self.lm_head = nn.Linear(args.hidden_size, args.vocab_size, bias=False)