Repository navigation
Closed
Description
Hello,
I am trying to use Yi-34b model using this code
model_name = 'chargoddard/Yi-34B-Llama'
max_seq_length = 2048
learning_rate = 2e-4
weight_decay = 0.01
warmup_steps = 10
batch_size = 1
gradient_accumulation_steps = 16
lr_scheduler_type = "linear"
optimizer = "adamw_8bit"
use_gradient_checkpointing = True
random_state = 3407
from unsloth import FastLlamaModel
import torch
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
HAS_BFLOAT16 = torch.cuda.is_bf16_supported()
model, tokenizer = FastLlamaModel.from_pretrained(
model_name = model_name,
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
# token = "hf_...", # use one if using gated models like meta-llama/Llama-2-7b-hf
)
but I am getting the following error
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[23], line 7
4 load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
5 HAS_BFLOAT16 = torch.cuda.is_bf16_supported()
----> 7 model, tokenizer = FastLlamaModel.from_pretrained(
8 model_name = model_name,
9 max_seq_length = max_seq_length,
10 dtype = dtype,
11 load_in_4bit = load_in_4bit,
12 # token = "hf_...", # use one if using gated models like meta-llama/Llama-2-7b-hf
13 )
File /mnt/a0b764eb-cdc5-4f46-9a2e-e2f11deba631/PYTHON_CACHE/unsloth/lib/python3.11/site-packages/unsloth/models/llama.py:658, in FastLlamaModel.from_pretrained(model_name, max_seq_length, dtype, load_in_4bit, token, device_map, rope_scaling)
643 bnb_config = BitsAndBytesConfig(
644 load_in_4bit = True,
645 bnb_4bit_use_double_quant = True,
646 bnb_4bit_quant_type = "nf4",
647 bnb_4bit_compute_dtype = dtype,
648 )
650 model = AutoModelForCausalLM.from_pretrained(
651 model_name,
652 device_map = device_map,
(...)
656 rope_scaling = rope_scaling,
657 )
--> 658 tokenizer = AutoTokenizer.from_pretrained(
659 model_name,
660 model_max_length = max_seq_length,
661 padding_side = "right",
662 token = token,
663 )
665 model, tokenizer = patch_tokenizer(model, tokenizer)
666 model = FastLlamaModel.post_patch(model)
File /mnt/a0b764eb-cdc5-4f46-9a2e-e2f11deba631/PYTHON_CACHE/unsloth/lib/python3.11/site-packages/transformers/models/auto/tokenization_auto.py:784, in AutoTokenizer.from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs)
782 tokenizer_class = tokenizer_class_from_name(tokenizer_class_candidate)
783 if tokenizer_class is None:
--> 784 raise ValueError(
785 f"Tokenizer class {tokenizer_class_candidate} does not exist or is not currently imported."
786 )
787 return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
789 # Otherwise we have to be creative.
790 # if model is an encoder decoder, the encoder tokenizer class is used by default
ValueError: Tokenizer class YiTokenizer does not exist or is not currently imported.
Could you tell me what I am doing wrong? Thank you!
Metadata
Metadata
Assignees
Labels
No labels
Activity
danielhanchen commentedon Dec 24, 2023
@C00reNUT Does loading that specific tokenizer work normally via
AutoTokenizer.from_pretrained?C00reNUT commentedon Dec 24, 2023
Well, when I was finetuning Mistral using FastMistralModel class everything worked just fine. I didn't try to finetune other Llama model yet.
C00reNUT commentedon Dec 24, 2023
If you mean this
I am getting the same error
danielhanchen commentedon Dec 24, 2023
@C00reNUT That seems like a Huggingface error :(
danielhanchen commentedon Dec 24, 2023
If you look at https://huggingface.co/01-ai/Yi-34B/blob/main/tokenizer_config.json, it shows the tokenizer as
LlamaTokenizerdanielhanchen commentedon Dec 24, 2023
Wait, can't you just use https://huggingface.co/01-ai/Yi-34B directly? Ie
01-ai/Yi-34B. I'm pretty sure Unsloth supports Yi since its a Llama archC00reNUT commentedon Dec 24, 2023
thank you now, it works
danielhanchen commentedon Dec 25, 2023
@C00reNUT Great! If you need any help - ask away!
C00reNUT commentedon Dec 26, 2023
@danielhanchen thank you, I am able to get 2048 context on 3090, while on axolotl I was able to do cca 1500. Also the speed is maybe 30 percent better.
I was hoping for full context after seeing some of your benchmarks but, I am probably too demanding :) Hopefully you will allow to buy some more powerful pro licensed version soon...
danielhanchen commentedon Dec 26, 2023
@C00reNUT Have you tried batch size = 1 maybe? (Or I'm assuming it's that?) Oh 30% better than Axolotl? That's pretty sick! (Packing no packing? :) )
We're still figuring stuff out, but glad at least you got a bit more context and it's faster :)
C00reNUT commentedon Dec 26, 2023
@danielhanchen Yes, comparing to axolotl and using batch size = 1.
Thank you for providing at least some functionality for free. From business perspective it will be interesting to see, how you will structure those pro licenses. You will need to have to some recurring fees to sustain the costs of development for yourself...
danielhanchen commentedon Dec 26, 2023
Thanks @C00reNUT ! Extremely appreciate it! Your comment made my day! :) I will definitely get back to you in the near future on licensing :) Thanks again!
Memory Efficient GRPO (unslothai#51)
Memory Efficient GRPO (unslothai#51)
Memory Efficient GRPO (unslothai#51)
Merge pull request unslothai#51 from unslothai/feature/print-outbound…
Fix review findings for PR #51: stop-button cancel path
Fix round-2 review findings for PR #51
Trim verbose comments on PR #51 changes