Skip to content

Commit

Permalink
Add overview section to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed Aug 30, 2024
1 parent c009f89 commit 6d76f89
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ specific to your environment. Then you can install OLMo-core from PyPI with:
pip install ai2-olmo-core
.. toctree::
:hidden:
:maxdepth: 2
:caption: Overview

overview/introduction.rst
overview/installation.rst

.. toctree::
:hidden:
:maxdepth: 2
Expand Down
9 changes: 9 additions & 0 deletions docs/source/overview/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Installation
============

Prior to installing OLMo-core you should install `PyTorch <https://pytorch.org>`_ according to the official instructions
specific to your operating system and hardware.

Then you can install OLMo-core from `PyPI <https://pypi.org/project/ai2-olmo-core/>`_ with::

pip install ai2-olmo-core
48 changes: 48 additions & 0 deletions docs/source/overview/introduction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Introduction
============

OLMo-core represents a major rewrite of the original training and modeling code from `OLMo <https://github.com/allenai/OLMo>`_
with a focus on performance and API stability.
It aims to provide a standard set of robust tools that can be used by LLM researchers at `AI2 <https://allenai.org>`_ and other organizations
to build their research projects on.

The library is centered around a highly efficient, yet flexible, :class:`~olmo_core.train.Trainer` and a :mod:`~olmo_core.launch`
module that handles all of the boilerplate of launching experiments on `Beaker <https://beaker.org>`_
or other platforms. It also comes with a simple, yet optimized, :class:`~olmo_core.nn.transformer.Transformer`
model and many other useful :class:`torch.nn.Module` implementations.

Most users will likely follow a workflow that looks like this:

1. Define the various components of an experiment through configuration classes.
For example::

model_config = TransformerConfig.llama2_7B(...)
optim_config = AdamWConfig(lr=1e-3, ...)
data_config = MemMapDatasetConfig(...)
trainer_config = TrainerConfig(...)

2. Build the corresponding components within a ``main()`` function at runtime and then call :meth:`Trainer.fit() <olmo_core.train.Trainer.fit>`.
For example::

def main(model_config, optim_config, data_config, trainer_config):
model = model_config.build()
optim = optim_config.build()
dataset = data_config.build()
trainer = trainer_config.build(model, optim, dataset)

trainer.fit()

if __name__ == "__main__":
prepare_training_environment(seed=SEED)
try:
main()
finally:
teardown_training_environment()

3. Launch their training script with a :mod:`~olmo_core.launch` config, like the :class:`~olmo_core.launch.beaker.BeakerLaunchConfig`.
For example::

launch_config = BeakerLaunchConfig(...)
launch_config.launch(follow=True)

You can find a complete example of this workflow in the `Train a language model <examples/train.rst>`_ example.

0 comments on commit 6d76f89

Please sign in to comment.