Skip to content

[FUCK] remove fastsafetensors#5371

Merged
Jiang-Jia-Jun merged 1 commit intoPaddlePaddle:developfrom
yuanlehome:remove_fastsafetensors
Dec 4, 2025
Merged

[FUCK] remove fastsafetensors#5371
Jiang-Jia-Jun merged 1 commit intoPaddlePaddle:developfrom
yuanlehome:remove_fastsafetensors

Conversation

@yuanlehome
Copy link
Collaborator

@yuanlehome yuanlehome commented Dec 4, 2025

Motivation

💡 If this PR is a Cherry Pick, the PR title needs to follow the format by adding the [Cherry-Pick] label at the very beginning and appending the original PR ID at the end. For example, [Cherry-Pick][CI] Add check trigger and logic(#5191)

💡 如若此PR是Cherry Pick,PR标题需遵循格式,在最开始加上[Cherry-Pick]标签,以及最后面加上原PR ID,例如[Cherry-Pick][CI] Add check trigger and logic(#5191)

*** for #5330

Modifications

Usage or Command

Accuracy Tests

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

Copilot AI review requested due to automatic review settings December 4, 2025 10:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request removes the fastsafetensors dependency from the codebase and consolidates on using the standard safetensors library (version >=0.7.0). The PR eliminates the custom fastsafetensors loading mechanism and associated workarounds, simplifying the weight loading infrastructure.

Key Changes:

  • Removed fastsafetensors dependency from all requirements files and updated safetensors to version >=0.7.0
  • Removed fastsafetensors_weights_iterator and load_tp_checkpoint_v1 functions from weight loading utilities
  • Removed use_fastsafetensor configuration option and related environment variable
  • Removed the _patch_fastsafetensors() workaround function from package initialization

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
requirements_metaxgpu.txt Removed fastsafetensors==0.1.14, updated safetensors from ==0.7.0rc0 to >=0.7.0
requirements_iluvatar.txt Removed fastsafetensors==0.1.14, updated safetensors from ==0.7.0rc0 to >=0.7.0
requirements_dcu.txt Removed fastsafetensors==0.1.14, updated safetensors from ==0.7.0rc0 to >=0.7.0
requirements.txt Updated safetensors from >=0.7.0rc0 to >=0.7.0
fastdeploy/model_executor/load_weight_utils.py Removed fastsafetensors imports and related functions; simplified load_composite_checkpoint to use standard safetensors loading only
fastdeploy/envs.py Removed FD_USE_FASTSAFETENSOR environment variable
fastdeploy/engine/engine.py Updated regex pattern to remove "fastsafetensors" from checkpoint loading progress detection
fastdeploy/engine/async_llm.py Updated regex pattern to remove "fastsafetensors" from checkpoint loading progress detection
fastdeploy/config.py Removed use_fastsafetensor configuration field from LoadConfig
fastdeploy/init.py Removed subprocess and sys imports; removed _patch_fastsafetensors() function and its invocation

Critical Issues with PR Metadata:

  1. PR Title: The title "[FUCK] remove fastsafetensors" contains unprofessional language. According to the project's PR guidelines, titles should follow the format [TAG]Title where TAG should be one of the standard tags like [BugFix], [Feature], [Optimization], etc. Please change the title to something professional like [Optimization] Remove fastsafetensors dependency or [Feature] Remove fastsafetensors dependency.

  2. PR Description: The PR description is incomplete. According to the guidelines, it should include:

    • Motivation: Why is fastsafetensors being removed? (e.g., "The fastsafetensors library is no longer needed as safetensors>=0.7.0 provides all required functionality")
    • Modifications: A clear list of what was changed (e.g., removed fastsafetensors dependency, removed related code, updated safetensors version constraints)
    • Testing: How this change was tested to ensure no regression

Please update the PR metadata before merging.

def load_pre_sharded_checkpoint(model_path: str, local_rank: int, use_fastsafetensor: bool = False):
def load_pre_sharded_checkpoint(model_path: str, local_rank: int):
"""
load_pre_sharded_checkpoint
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function signature for load_pre_sharded_checkpoint has been modified to remove the use_fastsafetensor parameter. However, the docstring still just says "load_pre_sharded_checkpoint" without describing the function's purpose or its parameters. Consider updating the docstring to reflect the current function signature and provide a meaningful description of what the function does and what parameters it expects.

Suggested change
load_pre_sharded_checkpoint
Loads a pre-sharded checkpoint for a given model and local rank.
Args:
model_path (str): Path to the model directory containing checkpoint shards.
local_rank (int): The local rank (shard index) to load.
Returns:
dict: A state dictionary mapping parameter names to their corresponding tensors.

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@f88c159). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fastdeploy/model_executor/load_weight_utils.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5371   +/-   ##
==========================================
  Coverage           ?   59.78%           
==========================================
  Files              ?      325           
  Lines              ?    40207           
  Branches           ?     6086           
==========================================
  Hits               ?    24039           
  Misses             ?    14276           
  Partials           ?     1892           
Flag Coverage Δ
GPU 59.78% <33.33%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Jiang-Jia-Jun Jiang-Jia-Jun merged commit 41c63f6 into PaddlePaddle:develop Dec 4, 2025
17 of 22 checks passed
@paddle-bot
Copy link

paddle-bot bot commented Dec 4, 2025

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants