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

Refactor checkpoint conversion script for improved readability and efficiency #633

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tdas3001
Copy link

  • Replaced os.path.join with Pathlib for improved readability and efficiency
  • Used Path.glob() instead of glob(os.path.join(...)) for file operations
  • Simplified directory creation with Path.mkdir(parents=True, exist_ok=True)
  • Refactored parameter splitting logic to remove unnecessary loops and redundant conditions
  • Used direct indexing for expert assignment instead of iterating over all model parallel indices
  • Replaced .narrow() with Python slicing for improved readability
  • Added an assertion to ensure mp > 0 before proceeding
  • Reorganized key mapping logic for better readability and maintainability
  • Optimized name modifications using a single chained .replace() operation
  • Ensured that only necessary operations are performed when processing model parameters

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.

1 participant