mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-23 00:17:25 +08:00
[BugFix]fix v1 loader lm head fp32 (#5270) (#5287)
CE Compile Job / ce_job_pre_check (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled
CE Compile Job / ce_job_pre_check (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled
This commit is contained in:
@@ -120,10 +120,10 @@ class ParallelEHProjection(nn.Layer):
|
|||||||
weight_tensor = get_tensor(state_dict.pop(self.weight_key)).astype(paddle.get_default_dtype())
|
weight_tensor = get_tensor(state_dict.pop(self.weight_key)).astype(paddle.get_default_dtype())
|
||||||
if self.linear.weight.shape != weight_tensor.shape:
|
if self.linear.weight.shape != weight_tensor.shape:
|
||||||
weight_tensor = weight_tensor.transpose([1, 0])
|
weight_tensor = weight_tensor.transpose([1, 0])
|
||||||
self.linear.weight.set_value(weight_tensor)
|
self.linear.weight.set_value(weight_tensor.astype(self.linear.weight.dtype))
|
||||||
|
|
||||||
if self.bias_key is not None:
|
if self.bias_key is not None:
|
||||||
bias = get_tensor(state_dict.pop(self.bias_key)).astype(paddle.get_default_dtype())
|
bias = get_tensor(state_dict.pop(self.bias_key)).astype(self.linear.bias.dtype)
|
||||||
self.linear.bias.set_value(bias)
|
self.linear.bias.set_value(bias)
|
||||||
|
|
||||||
def forward(self, input):
|
def forward(self, input):
|
||||||
|
|||||||
@@ -251,7 +251,9 @@ class Qwen2_5_VLForConditionalGeneration(ModelForCasualLM):
|
|||||||
self.model.load_state_dict(state_dict)
|
self.model.load_state_dict(state_dict)
|
||||||
self.visual.load_state_dict(state_dict)
|
self.visual.load_state_dict(state_dict)
|
||||||
if self.tie_word_embeddings:
|
if self.tie_word_embeddings:
|
||||||
self.lm_head.linear.weight.set_value(self.model.embed_tokens.embeddings.weight.transpose([1, 0]))
|
self.lm_head.linear.weight.set_value(
|
||||||
|
self.model.embed_tokens.embeddings.weight.transpose([1, 0]).astype(self.lm_head.linear.weight.dtype)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
self.lm_head.load_state_dict(state_dict)
|
self.lm_head.load_state_dict(state_dict)
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class TestGeneration(unittest.TestCase):
|
|||||||
model=MODEL_NAME,
|
model=MODEL_NAME,
|
||||||
max_num_batched_tokens=4096,
|
max_num_batched_tokens=4096,
|
||||||
tensor_parallel_size=1,
|
tensor_parallel_size=1,
|
||||||
|
lm_head_fp32=True,
|
||||||
engine_worker_queue_port=int(os.getenv("FD_ENGINE_QUEUE_PORT")),
|
engine_worker_queue_port=int(os.getenv("FD_ENGINE_QUEUE_PORT")),
|
||||||
cache_queue_port=int(os.getenv("FD_CACHE_QUEUE_PORT")),
|
cache_queue_port=int(os.getenv("FD_CACHE_QUEUE_PORT")),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user