Deploy error (RuntimeError: weight lm_head.weight does not exist)

#106
by steveleancommerce - opened

trying finetuned model enpoint
Full Error message like as below

[Server message]Endpoint failed to start
See details
Exit code: 1. Reason: n3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)

File "/opt/conda/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()

File "/opt/conda/lib/python3.10/site-packages/text_generation_server/server.py", line 229, in serve_inner
model = get_model_with_lora_adapters(

File "/opt/conda/lib/python3.10/site-packages/text_generation_server/models/init.py", line 1200, in get_model_with_lora_adapters
model = get_model(

File "/opt/conda/lib/python3.10/site-packages/text_generation_server/models/init.py", line 771, in get_model
return FlashCausalLM(

File "/opt/conda/lib/python3.10/site-packages/text_generation_server/models/flash_causal_lm.py", line 896, in init
model = model_class(prefix, config, weights)

File "/opt/conda/lib/python3.10/site-packages/text_generation_server/models/custom_modeling/flash_llama_modeling.py", line 535, in init
self.lm_head = SpeculativeHead.load(

File "/opt/conda/lib/python3.10/site-packages/text_generation_server/layers/speculative.py", line 40, in load
lm_head = TensorParallelHead.load(config, prefix, weights)

File "/opt/conda/lib/python3.10/site-packages/text_generation_server/layers/tensor_parallel.py", line 66, in load
weight = weights.get_tensor(f"{prefix}.weight")

File "/opt/conda/lib/python3.10/site-packages/text_generation_server/utils/weights.py", line 212, in get_tensor
filename, tensor_name = self.get_filename(tensor_name)

File "/opt/conda/lib/python3.10/site-packages/text_generation_server/utils/weights.py", line 193, in get_filename
raise RuntimeError(f"weight {tensor_name} does not exist")

RuntimeError: weight lm_head.weight does not exist
rank=0
2024-08-20T08:31:03.730990Z ERROR text_generation_launcher: Shard 0 failed to start
2024-08-20T08:31:03.731010Z  INFO text_generation_launcher: Shutting down shards
Error: ShardCannotStart

config.json like as below
v
{
"_name_or_path": "meta-llama/Meta-Llama-3.1-8B-Instruct",
"architectures": [
"LlamaForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bos_token_id": 128000,
"eos_token_id": [
128001,
128008,
128009
],
"hidden_act": "silu",
"hidden_size": 4096,
"initializer_range": 0.02,
"intermediate_size": 14336,
"max_position_embeddings": 131072,
"mlp_bias": false,
"model_type": "llama",
"num_attention_heads": 32,
"num_hidden_layers": 32,
"num_key_value_heads": 8,
"pretraining_tp": 1,
"rms_norm_eps": 1e-05,
"rope_scaling": {
"rope_type": "linear",
"factor": 8.0
},
"rope_theta": 500000.0,
"tie_word_embeddings": false,
"torch_dtype": "bfloat16",
"transformers_version": "4.42.3",
"use_cache": true,
"vocab_size": 128256
}

How to solve?

I had the exact same error in Llama 3.2 1B-Instruct.

I think the error in my case originated from 3.2 1B-Instruct having a file called 'model.safetensors' instead of the normal 'model-00001-of-00004.safetensors' (etc) that most models have. In order to get around this I used a different model, Llama 3 8B-Instruct, which successfully got past the issue.

But since reading your error I am a lot less confident that this was the root of the issue since 3.1-8B-Instruct has the model-00001... setup and you are encountering this problem. All the same, try a different model in the Llama family and see if that works as a fix, even if not a very satisfying one.

Sign up or log in to comment