Skip to content

Instantly share code, notes, and snippets.

View Manuscrit's full-sized avatar

Maxime RICHE Manuscrit

View GitHub Profile
@krishpop
krishpop / rl-packages.md
Last active April 1, 2021 07:49
RL Packages and Implementations
@wassname
wassname / InterpolatingScheduler.py
Last active March 2, 2019 08:30
A learning rate scheduler for pytorch which interpolates on log or linear scales
from torch.optim.lr_scheduler import _LRScheduler
import numpy as np
class InterpolatingScheduler(_LRScheduler):
def __init__(self, optimizer, steps, lrs, scale='log', last_epoch=-1):
"""A scheduler that interpolates given values
Args:
- optimizer: pytorch optimizer
- steps: list or array with the x coordinates of the interpolated values
@angstwad
angstwad / dict_merge.py
Last active December 22, 2024 16:02
Recursive dictionary merge in Python
import collections
def dict_merge(dct, merge_dct):
""" Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
updating only top-level keys, dict_merge recurses down into dicts nested
to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
``dct``.
:param dct: dict onto which the merge is executed
:param merge_dct: dct merged into dct