Giter VIP home page Giter VIP logo

graphsam's Introduction

GraphSAM->Efficient Sharpness-Aware Minimization for Molecular Graph Transformer Models

Training

CoMPT

cd CoMPT-main
python train_graph.py --seed 777 --fold 5 --epochs 30 --dataset <datasets> --split random --sam <GraphSAM> --rho <rho> --radius <radius> --epoch_steps <lambda> --alpha <beta> --gamma <gamma>
where <rho> is neighborhood ball size. <GraphSAM>=2 is the GraphSAM algorithm. <radius> is generally equal to <rho>. <lambda> is rho's update rate . <gamma>is step_rho's learning rate. <beta> is the smoothing parameter of the moving average.

from GraphSAM import GraphSAM

model = YourModel()
criterion = YourCriterion()
base_optimizer = YourBaseOptimizer

optimizer = GraphSAM(
    params=model.parameters(),
    rho=0.05,
    beta=0.99,
    gamma=0.5,
    lambda=1,
    base_optimizer=base_optimizer,
    **kwargs
)
for epoch in range(epochs):
  i=0
  for batch in (train_loader):
    def closure():
	output = model(input)
	loss = loss_f(output, target)
	loss.backward()
	return loss

    if i==0:
	output = model(input)
	loss=loss_f(output,target)
	optimizer.step(i, epoch, closure, loss)
    else:
	optimizer.step(i, epoch, closure)
    loss = optimizer.get_loss()
    optimizer.zero_grad()
...

Citation

@inproceedings{wang2024efficient,
title={Efficient Sharpness-Aware Minimization for Molecular Graph Transformer Models},
author={Yili Wang and Kaixiong Zhou and Ninghao Liu and Ying Wang and Xin Wang},
booktitle={The Twelfth International Conference on Learning Representations},
year={2024},
url={https://openreview.net/forum?id=Od39h4XQ3Y}
}

graphsam's People

Contributors

yl-wang avatar

Stargazers

Noah avatar zhujiem avatar Guancheng Wan avatar  avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.