ColossalAI
ColossalAI copied to clipboard
[BUG]: LlamaRM model has no attribute 'resize_token_embeddings'
π Describe the bug
LlamaRM is not a huggingface transformer module but LoraModule, while llamaRM.model is a huggingface transformer model. So LlamaRm has no function "resize_token_embeddings" but LlamaRM.model has. When using Llama to train RM model, it will raise the error: AttributeError: 'LlamaRM' object has no attribute 'resize_token_embeddings'
line 68 in coati/utils/tokenizer_utils.py
Environment
No response
Bot detected the issue body's language is not English, translate it automatically. π―ππ»π§βπ€βπ§π«π§πΏβπ€βπ§π»π©πΎβπ€βπ¨πΏπ¬πΏ
Title: [BUG]:
Met the same issue:
smart_tokenizer_and_embedding_resize(smart_tokenizer_and_embedding_resize(
File "/mnt/batch/tasks/shared/LS_root/mounts/clusters/x-gpu1/code/Users/x/code/ColossalAI/applications/Chat/coati/utils/tokenizer_utils.py", line 68, in smart_tokenizer_and_embedding_resize File "/mnt/batch/tasks/shared/LS_root/mounts/clusters/x-gpu1/code/Users/x/code/ColossalAI/applications/Chat/coati/utils/tokenizer_utils.py", line 68, in smart_tokenizer_and_embedding_resize model.resize_token_embeddings(len(tokenizer))model.resize_token_embeddings(len(tokenizer))
File "/anaconda/envs/coati/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1614, in getattr File "/anaconda/envs/coati/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1614, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LlamaRM' object has no attribute 'resize_token_embeddings'AttributeError: 'LlamaRM' object has no attribute 'resize_token_embeddings
Meet the same issue:
Traceback (most recent call last): File "/home/vmagent/app/ColossalAI/applications/Chat/examples/train_reward_model.py", line 166, in <module> train(args) File "/home/vmagent/app/ColossalAI/applications/Chat/examples/train_reward_model.py", line 77, in train tokenizer = prepare_llama_tokenizer_and_embedding(tokenizer, model) File "/home/vmagent/app/ColossalAI/applications/Chat/coati/utils/tokenizer_utils.py", line 37, in prepare_llama_tokenizer_and_embedding smart_tokenizer_and_embedding_resize( File "/home/vmagent/app/ColossalAI/applications/Chat/coati/utils/tokenizer_utils.py", line 68, in smart_tokenizer_and_embedding_resize model.resize_token_embeddings(len(tokenizer)) File "/opt/intel/oneapi/intelpython/latest/envs/coati/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1269, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LlamaRM' object has no attribute 'resize_token_embeddings'
Meet the same issue:
AttributeError: 'LlamaRM' object has no attribute 'resize_token_embeddings'
WARNING:torch.distributed.elastic.multiprocessing.api:Sending process 526441 closing signal SIGTERM
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 526440) of binary: /data/anaconda3/bin/python
Traceback (most recent call last):
File "/data/anaconda3/bin/torchrun", line 8, in
I met this error too, but if you are training the stage 2, you should modified the pretrain to Coati7B(you trained in stage 1) instead of LLaMA7B that provided by huggingface.
I met this error too, but if you are training the stage 2, you should modified the pretrain to Coati7B(you trained in stage 1) instead of LLaMA7B that provided by huggingface.
Thank you very much for the reminderοΌ
met the some problem , and i add the code at line 72 of train_reward_model.py , imitating train_sft.py :
tokenizer = LlamaTokenizer.from_pretrained(args.pretrain) tokenizer.eos_token = '<\s>' tokenizer.pad_token = tokenizer.eos_token
me too,i met the same problem
ubuntu@VM-0-5-ubuntu:~/Desktop/bookDesk202303061/text-generation-webui$ python3 server.py --cpu --model llama-7b-hf --lora chinese-alpaca-lora-7b Gradio HTTP request redirected to localhost :) bin /home/ubuntu/.local/lib/python3.8/site-packages/bitsandbytes/libbitsandbytes_cpu.so /home/ubuntu/.local/lib/python3.8/site-packages/bitsandbytes/cextension.py:33: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable. warn("The installed version of bitsandbytes was compiled without GPU support. " /home/ubuntu/.local/lib/python3.8/site-packages/torch/cuda/init.py:497: UserWarning: Can't initialize NVML warnings.warn("Can't initialize NVML") Loading llama-7b-hf... llama.cpp weights detected: models/llama-7b-hf/ggml-alpaca-7b-q4.bin
llama.cpp: loading model from models/llama-7b-hf/ggml-alpaca-7b-q4.bin
llama.cpp: can't use mmap because tensors are not aligned; convert to new format to avoid this
llama_model_load_internal: format = 'ggml' (old version with low tokenizer quality and no mmap support)
llama_model_load_internal: n_vocab = 32000
llama_model_load_internal: n_ctx = 2048
llama_model_load_internal: n_embd = 4096
llama_model_load_internal: n_mult = 256
llama_model_load_internal: n_head = 32
llama_model_load_internal: n_layer = 32
llama_model_load_internal: n_rot = 128
llama_model_load_internal: ftype = 2 (mostly Q4_0)
llama_model_load_internal: n_ff = 11008
llama_model_load_internal: n_parts = 1
llama_model_load_internal: model size = 7B
llama_model_load_internal: ggml ctx size = 4113739.11 KB
llama_model_load_internal: mem required = 5809.32 MB (+ 1026.00 MB per state)
...................................................................................................
.
llama_init_from_file: kv self size = 1024.00 MB
AVX = 1 | AVX2 = 1 | AVX512 = 1 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 0 | SSE3 = 1 | VSX = 0 |
Applying the following LoRAs to llama-7b-hf: chinese-alpaca-lora-7b
Traceback (most recent call last):
File "server.py", line 923, in
what should i do to fix it?