mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 16:48:03 +08:00
[V1 Loader] Support qwen2(bf16) (#3502)
Some checks failed
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
Deploy GitHub Pages / deploy (push) Has been cancelled
Some checks failed
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
Deploy GitHub Pages / deploy (push) Has been cancelled
* support qwen2(bf16) * merge bias_loader and weight_loader
This commit is contained in:
@@ -54,6 +54,20 @@ def set_weight_attrs(param, param_attr_map: Optional[dict[str, Any]]):
|
||||
setattr(param, key, value)
|
||||
|
||||
|
||||
def slice_fn(weight_or_paramter, output_dim, start, end, step=1):
|
||||
if hasattr(weight_or_paramter, "get_shape"):
|
||||
shape = weight_or_paramter.get_shape()
|
||||
else:
|
||||
shape = weight_or_paramter.shape
|
||||
if len(shape) == 1:
|
||||
weight_or_paramter = weight_or_paramter[start:end]
|
||||
elif output_dim:
|
||||
weight_or_paramter = weight_or_paramter[..., start:end]
|
||||
else:
|
||||
weight_or_paramter = weight_or_paramter[start:end, ...]
|
||||
return weight_or_paramter
|
||||
|
||||
|
||||
def default_weight_loader(fd_config: FDConfig) -> None:
|
||||
"""Default weight loader"""
|
||||
|
||||
|
Reference in New Issue
Block a user