Update loader.py
This commit is contained in:
parent
762185dd7b
commit
fc3a2dfc8e
1 changed files with 1 additions and 18 deletions
|
|
@ -32,7 +32,7 @@ pass
|
|||
from huggingface_hub import HfFileSystem
|
||||
|
||||
# https://github.com/huggingface/transformers/pull/26037 allows 4 bit loading!
|
||||
from unsloth_zoo.utils import Version
|
||||
from unsloth_zoo.utils import Version, _get_dtype
|
||||
transformers_version = Version(transformers_version)
|
||||
SUPPORTS_FOURBIT = transformers_version >= Version("4.37")
|
||||
SUPPORTS_GEMMA = transformers_version >= Version("4.38")
|
||||
|
|
@ -47,23 +47,6 @@ if SUPPORTS_GEMMA2:
|
|||
pass
|
||||
import torch
|
||||
|
||||
def _get_dtype(dtype):
|
||||
__DTYPE_MAP = {
|
||||
"float32": torch.float32,
|
||||
torch.float32: torch.float32,
|
||||
"float16": torch.float16,
|
||||
torch.float16: torch.float16,
|
||||
"bfloat16": torch.bfloat16,
|
||||
torch.bfloat16: torch.bfloat16,
|
||||
}
|
||||
if dtype is None or dtype == None: return None
|
||||
elif dtype in __DTYPE_MAP: return __DTYPE_MAP[dtype]
|
||||
else:
|
||||
print(f"Unsloth: {dtype} is not recognized, so we'll default to None")
|
||||
return None
|
||||
pass
|
||||
pass
|
||||
|
||||
|
||||
class FastLanguageModel(FastLlamaModel):
|
||||
@staticmethod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue