Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
^README\.Rmd$
^\.github$
^CRAN-RELEASE$
^\.git$
^cran-comments\.md$
58 changes: 12 additions & 46 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
Expand All @@ -24,62 +22,30 @@ jobs:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
TORCH_INSTALL: 1
TORCH_TEST: 1

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
extra-packages: any::rcmdcheck
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
args: 'c("--no-manual", "--as-cran")'
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Package: madgrad
Title: 'MADGRAD' Method for Stochastic Optimization
Version: 0.1.0.9000
Version: 0.2.0
Authors@R: c(
person("Daniel", "Falbel", email = "daniel@rstudio.com", role = c("aut", "cre", "cph")),
person(family = "RStudio", role = c("cph")),
person("Daniel", "Falbel", email = "dfalbel@gmail.com", role = c("aut", "cre", "cph")),
person(family = "Posit Software, PBC", role = c("cph")),
person(family = "MADGRAD original implementation authors.", role = c("cph"))
)
Description: A Momentumized, Adaptive, Dual Averaged Gradient Method for Stochastic
Optimization algorithm. MADGRAD is a 'best-of-both-worlds' optimizer with the
generalization performance of stochastic gradient descent and at least as fast
convergence as that of Adam, often faster. A drop-in optim_madgrad() implementation
is provided based on Defazio et al (2020) <arxiv:2101.11075>.
is provided based on Defazio et al (2020) <doi:10.48550/arXiv.2101.11075>.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
RoxygenNote: 7.3.3
Imports:
torch (>= 0.3.0),
rlang
Expand Down
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(optim_madgrad)
importFrom(rlang,abort)
importFrom(torch,optimizer)
importFrom(torch,torch_is_installed)
importFrom(torch,torch_zeros_like)
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# madgrad (development version)
# madgrad 0.2.0

* Changed maintainer email address.

# madgrad 0.1.0

Expand Down
2 changes: 2 additions & 0 deletions R/madgrad.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#' @returns
#' An optimizer object implementing the `step` and `zero_grad` methods.
#'
#' @importFrom torch optimizer torch_zeros_like torch_is_installed
#' @importFrom rlang abort
#' @export
optim_madgrad <- torch::optimizer(
initialize = function(params, lr = 1e-2, momentum = 0.9, weight_decay = 0,
Expand Down
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ knitr::opts_chunk$set(
<!-- badges: start -->
[![R-CMD-check](https://github.com/mlverse/madgrad/workflows/R-CMD-check/badge.svg)](https://github.com/mlverse/madgrad/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/madgrad)](https://CRAN.R-project.org/package=madgrad)
[![Downloads](https://cranlogs.r-pkg.org/badges/madgrad)](https://CRAN.R-project.org/package=madgrad)
<!-- badges: end -->

The Madgrad package is an R port of the original [madgrad](https://github.com/facebookresearch/madgrad) by Aaron Defazio and Samy Jelassi.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[![R-CMD-check](https://github.com/mlverse/madgrad/workflows/R-CMD-check/badge.svg)](https://github.com/mlverse/madgrad/actions)
[![CRAN
status](https://www.r-pkg.org/badges/version/madgrad)](https://CRAN.R-project.org/package=madgrad)
[![Downloads](https://cranlogs.r-pkg.org/badges/madgrad)](https://CRAN.R-project.org/package=madgrad)
<!-- badges: end -->

The Madgrad package is an R port of the original
Expand Down
9 changes: 9 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## R CMD check results

0 errors | 0 warnings | 0 notes

## Maintainer change

The maintainer email has changed from daniel@rstudio.com to dfalbel@gmail.com.
This is the same person (Daniel Falbel). The previous email was a corporate
address that is no longer active.
Loading