diff --git a/README.md b/README.md index 836f83b..7afe594 100644 --- a/README.md +++ b/README.md @@ -16,16 +16,13 @@ Without hyperparameter tuning or validation-based checkpointing, the LoRA model ### Setup -Until Jason Phang's [LLaMA implementation](https://github.com/huggingface/transformers/pull/21955) -is merged, users will need to replace their local `transformers` package. - -1. Install dependencies (**install zphang's transformers fork**) +1. Install dependencies ``` pip install -q datasets loralib sentencepiece accelerate pip uninstall transformers -pip install -q git+https://github.com/zphang/transformers@c3dc391 +pip install -q git+https://github.com/huggingface/transformers.git pip install -q git+https://github.com/huggingface/peft.git ``` diff --git a/export_state_dict_checkpoint.py b/export_state_dict_checkpoint.py index c1d54f8..ae010ba 100644 --- a/export_state_dict_checkpoint.py +++ b/export_state_dict_checkpoint.py @@ -3,11 +3,11 @@ import json import torch from peft import PeftModel, LoraConfig -from transformers import LLaMATokenizer, LLaMAForCausalLM +from transformers import LlamaTokenizer, LlamaForCausalLM -tokenizer = LLaMATokenizer.from_pretrained("decapoda-research/llama-7b-hf") +tokenizer = LlamaTokenizer.from_pretrained("decapoda-research/llama-7b-hf") -base_model = LLaMAForCausalLM.from_pretrained( +base_model = LlamaForCausalLM.from_pretrained( "decapoda-research/llama-7b-hf", load_in_8bit=False, torch_dtype=torch.float16, diff --git a/finetune.py b/finetune.py index e0cae5e..edfc560 100644 --- a/finetune.py +++ b/finetune.py @@ -6,7 +6,7 @@ import torch.nn as nn import bitsandbytes as bnb from datasets import load_dataset import transformers -from transformers import AutoTokenizer, AutoConfig, LLaMAForCausalLM, LLaMATokenizer +from transformers import AutoTokenizer, AutoConfig, LlamaForCausalLM, LlamaTokenizer from peft import prepare_model_for_int8_training, LoraConfig, get_peft_model @@ -21,12 +21,12 @@ LORA_R = 8 LORA_ALPHA = 16 LORA_DROPOUT = 0.05 -model = LLaMAForCausalLM.from_pretrained( +model = LlamaForCausalLM.from_pretrained( "decapoda-research/llama-7b-hf", load_in_8bit=True, device_map="auto", ) -tokenizer = LLaMATokenizer.from_pretrained( +tokenizer = LlamaTokenizer.from_pretrained( "decapoda-research/llama-7b-hf", add_eos_token=True ) diff --git a/generate.py b/generate.py index 5ba941e..c66c694 100644 --- a/generate.py +++ b/generate.py @@ -1,10 +1,10 @@ import torch from peft import PeftModel -from transformers import LLaMATokenizer, LLaMAForCausalLM, GenerationConfig +from transformers import LlamaTokenizer, LlamaForCausalLM, GenerationConfig -tokenizer = LLaMATokenizer.from_pretrained("decapoda-research/llama-7b-hf") +tokenizer = LlamaTokenizer.from_pretrained("decapoda-research/llama-7b-hf") -model = LLaMAForCausalLM.from_pretrained( +model = LlamaForCausalLM.from_pretrained( "decapoda-research/llama-7b-hf", load_in_8bit=True, torch_dtype=torch.float16, diff --git a/lengths.ipynb b/lengths.ipynb index f2f55ba..e8f4096 100644 --- a/lengths.ipynb +++ b/lengths.ipynb @@ -19,10 +19,10 @@ ], "source": [ "from datasets import load_dataset\n", - "from transformers import LLaMATokenizer\n", + "from transformers import LlamaTokenizer\n", "\n", "\n", - "tokenizer = LLaMATokenizer.from_pretrained(\"decapoda-research/llama-7b-hf\", add_eos_token=True)\n", + "tokenizer = LlamaTokenizer.from_pretrained(\"decapoda-research/llama-7b-hf\", add_eos_token=True)\n", "tokenizer.pad_token = tokenizer.eos_token\n", "tokenizer.pad_token_id = tokenizer.eos_token_id\n", "\n",