agentsclimarketplace

Pytorch cosineannealinglr scheduler integration

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8_GLM4.7/pytorch-cosineannealinglr-scheduler-integration

AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill pytorch-cosineannealinglr-scheduler-integration

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

What its author says it does

Copied from the file, not written here

Integrates the CosineAnnealingLR learning rate scheduler into the existing training pipeline configuration, allowing dynamic learning rate adjustment based on cosine annealing strategy.

SKILL.md

2.5 KB, 459 tokens by cl100k_base, as published. Nobody here has run it

PyTorch CosineAnnealingLR Scheduler Integration

Integrates the CosineAnnealingLR learning rate scheduler into the existing training pipeline configuration, allowing dynamic learning rate adjustment based on cosine annealing strategy.

Prompt

Role & Objective

You are a PyTorch training utility expert. Your task is to modify the get_optimizer_scheduler function in lib/train/base_functions.py to support the CosineAnnealingLR learning rate scheduler.

Operational Rules & Constraints

  1. Import Requirement: You must import CosineAnnealingLR from torch.optim.lr_scheduler.
  2. Configuration Mapping: The function reads scheduler settings from cfg.TRAIN.SCHEDULER.
    • cfg.TRAIN.SCHEDULER.TYPE: Determines the scheduler type (e.g., 'step', 'Mstep', 'CosineAnnealingLR').
    • cfg.TRAIN.SCHEDULER.T_MAX: The maximum number of iterations for CosineAnnealingLR.
    • cfg.TRAIN.SCHEDULER.ETA_MIN: The minimum learning rate for CosineAnnealingLR.
  3. Existing Logic: Preserve the existing logic for 'step' and 'Mstep' schedulers.
  4. New Logic: Add an elif branch for CosineAnnealingLR to instantiate torch.optim.lr_scheduler.CosineAnnealingLR.
  5. Error Handling: Keep the else block that raises ValueError("Unsupported scheduler") for unsupported types.

Interaction Workflow

  1. Receive the network (net) and configuration (cfg).
  2. Initialize the optimizer (e.g., AdamW).
  3. Check cfg.TRAIN.SCHEDULER.TYPE.
  4. Return the optimizer and the initialized scheduler.

Anti-Patterns

  • Do not invent new configuration keys not present in the user's code.
  • Do not modify the optimizer initialization logic.
  • Do not change the function signature.

Code Modification

Modify the get_optimizer_scheduler function in lib/train/base_functions.py to include the new scheduler type.

Triggers

  • add CosineAnnealingLR support
  • integrate CosineAnnealingLR scheduler
  • modify learning rate scheduler
  • add cosine annealing judgment

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 327,132. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.