Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to code exporting #728

Open
kevinwuTT opened this issue Jan 27, 2025 · 0 comments
Open

Improvements to code exporting #728

kevinwuTT opened this issue Jan 27, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@kevinwuTT
Copy link
Contributor

kevinwuTT commented Jan 27, 2025

Original PR: #611

Improvements

  • Analyze and report accuracy failures in Github CI
    Currently, the standalone scripts will run and fail silently. The logs will show which models fail and where, but this is not easy to view.
    Possibly dump a json file if a comparison fails and have the CI process it.

  • Organize into a base module that only exports standalone runnable code.
    Separate modules to export additional code:

  • Separate forward functions into separate definitions that mimics the original test model more closely.
    It's currently simpler to fuse all of the forward functions since the input data is only applicable for the first forward function. But this may not be representative of the original model with separate graph breaks.

  • Using safetensors instead of pickle
    There are issues with saving the tensors in this format because of share memory. save_model won't work because this is not a torch.nn.Module.

    RuntimeError: 
        Some tensors share memory, this will lead to duplicate memory on disk and potential differences when loading them again: [{'arg0_1', 'arg27_1'}].
        A potential way to correctly save your model is to use `save_model`.
        More information at https://huggingface.co/docs/safetensors/torch_shared_tensors
    
  • inspect.getsource() assumes the target function is always accessible and valid. This may fail if node.target is dynamically created or a non-source-mapped function.

@kevinwuTT kevinwuTT added the enhancement New feature or request label Jan 27, 2025
@kevinwuTT kevinwuTT self-assigned this Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant