Skip to content

Commit

Permalink
Update code and docs to latest version (#4)
Browse files Browse the repository at this point in the history
* Update README and add docs

* Update to latest version of code

* Run formatter

* init

* Fix pylint warnings

* Make run command in readme run successfully, add profiling data

* Remove scripts and experiments

* Fix batch.completed conflicting definitions

* Use github python gitgignore as base

* Remove experiments folder

* Remove constants from execution time predictor
  • Loading branch information
nitinkedia7 authored Jan 10, 2024
1 parent b0a617c commit 0633efa
Show file tree
Hide file tree
Showing 45 changed files with 188,887 additions and 660,108 deletions.
174 changes: 161 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,165 @@
env
env_2
env_pypy
cache
cache_lr
env_cpython
.vscode
# data
simulator_output
wandb

# python files
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
.ipynb_checkpoints

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Custom
simulator_output*
wandb
.cache
81 changes: 65 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
# LLM Inference Simulator

## Overview

LLM inference system simulator.
# VIDUR: LLM Inference Simulator

## Setup

To run the simulator, create a conda environment with the given dependency file.
### Using `mamba`

```
conda env create -p ./env -f ./environment.yml
To run the simulator, create a mamba environment with the given dependency file.

```sh
mamba env create -p ./env -f ./environment.yml
```

## Formatting Code
### Using `venv`

To run the code formatters execute the following command,
1. Ensure that you have python 3.10 installed on your system. Refer <https://www.bitecode.dev/p/installing-python-the-bare-minimum>
2. `cd` into the repository root
3. Create a virtual environment using `venv` module using `python3.10 -m venv .venv`
4. Activate the virtual environment using `source .venv/bin/activate`
5. Install the dependencies using `python -m pip install -r requirements.txt`
6. Run `deactivate` to deactivate the virtual environment

```
make format
### Using `conda` (Least recommended)

To run the simulator, create a conda environment with the given dependency file.

```sh
conda env create -p ./env -f ./environment.yml
```

## Setting up wandb
## Setting up wandb (Optional)

First, setup your account on https://microsoft-research.wandb.io/, obtain the api key and then run the following command,
First, setup your account on <https://microsoft-research.wandb.io/>, obtain the api key and then run the following command,

```
```sh
wandb login --host https://microsoft-research.wandb.io
```

Expand All @@ -34,12 +41,54 @@ If you wish to skip wandb setup, simply comment out `wandb_project` and `wandb_g

To run the simulator, simply execute the following command from the repository root,

```
```sh
python -m simulator.main
```

or a big example with all the parameters,

```sh
python -m simulator.main \
--replica_model_name codellama/CodeLlama-34b-Instruct-hf \
--replica_num_layers 48 \
--replica_num_q_heads 64 \
--replica_num_kv_heads 8 \
--replica_embedding_dim 8192 \
--replica_mlp_hidden_dim 22016 \
--replica_vocab_size 32768 \
--replica_use_gated_mlp \
--replica_fp16_tflops 312 \
--replica_total_memory_gb 80 \
--sklearn_execution_time_predictor_compute_input_file ./data/profiling/a100/mlp.csv \
--sklearn_execution_time_predictor_attention_input_file ./data/profiling/a100/mixed_attention.csv \
--sklearn_execution_time_predictor_all_reduce_input_file ./data/profiling/a100/all_reduce.csv \
--sklearn_execution_time_predictor_send_recv_input_file ./data/profiling/a100/p2p_intra_node.csv \
--sklearn_execution_time_predictor_cpu_overhead_input_file ./data/profiling/a100/cpu_overheads.csv \
--cluster_num_replicas 1 \
--replica_num_tensor_parallel_workers 1 \
--request_generator_provider synthetic \
--synthetic_request_generator_length_provider trace \
--trace_request_length_generator_trace_file ./data/processed_traces/cnn_dailymail_stats_llama2_tokenizer.csv \
--synthetic_request_generator_interval_provider poisson \
--poisson_request_interval_generator_qps 0.75 \
--synthetic_request_generator_num_requests 256 \
--replica_scheduler_provider vllm \
--replica_scheduler_batch_size_cap 128
```

The simulator supports a plethora of parameters for the simulation description of which can be found [here](docs/simulator_params.md).

The metrics will be logged to wandb directly and copy will be stored in `simulator_output` directory along with the chrome trace. Description of all the logged metrics can be found [here](docs/simulator_metrics.md).

## Formatting Code

To run the code formatters execute the following command,

```sh
make format
```


## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand Down
Loading

0 comments on commit 0633efa

Please sign in to comment.