Skip to content

Conversation

leshanbog
Copy link
Contributor

@leshanbog leshanbog commented Dec 24, 2022

In this PR:

  • Linear LR scheduler is added. It was used in InstructGPT. From the paper:

image

  • Tested with config:
scheduler:
  name: "linear"
  kwargs:
    start_factor: 0.1
    end_factor: 1.0
    total_iters: 64

image

  • Some unused code is removed

Copy link
Collaborator

@jon-tow jon-tow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for another great PR :)

Note: In the far future we may want to consider using StrEnum for Python >= 3.11 as 3.11 introduces a breaking change in f-string handling of Enum str mixin accesses (f"{Enum.FOO}" does not return the value string of FOO).

Comment on lines -30 to -42
def flatten(L: Iterable[Iterable[Any]]) -> Iterable[Any]:
"""
Flatten a list of lists into a single list (i.e. [[1, 2], [3, 4]] -> [1,2,3,4])
"""
return list(reduce(lambda acc, x: acc + x, L, []))


def chunk(L: Iterable[Any], chunk_size: int) -> List[Iterable[Any]]:
"""
Chunk iterable into list of iterables of given chunk size
"""
return [L[i : i + chunk_size] for i in range(0, len(L), chunk_size)]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIce cleanup 👍



class OptimizerNames(Enum):
class OptimizerName(str, Enum):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea with the str mixin.

@jon-tow jon-tow merged commit 40126e8 into CarperAI:main Dec 25, 2022
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.

2 participants