Skip to content

Commit 828b643

Browse files
samsjaJackmin801
andcommitted
Initial commit
--------- Co-authored-by: Jackmin801 <[email protected]> Co-authored-by: Jackmin801 <[email protected]>
0 parents  commit 828b643

37 files changed

+3426
-0
lines changed

.dockerignore

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Training
2+
3+
*/wandb/*
4+
*/data/*
5+
*/outputs/*
6+
7+
# Git
8+
.git
9+
.gitignore
10+
11+
# Docker
12+
docker-compose.yml
13+
.docker
14+
15+
# Byte-compiled / optimized / DLL files
16+
__pycache__/
17+
*/__pycache__/
18+
*/*/__pycache__/
19+
*/*/*/__pycache__/
20+
*.py[cod]
21+
*/*.py[cod]
22+
*/*/*.py[cod]
23+
*/*/*/*.py[cod]
24+
25+
# C extensions
26+
*.so
27+
28+
# Distribution / packaging
29+
.Python
30+
env/
31+
build/
32+
develop-eggs/
33+
dist/
34+
downloads/
35+
eggs/
36+
lib/
37+
lib64/
38+
parts/
39+
sdist/
40+
var/
41+
*.egg-info/
42+
.installed.cfg
43+
*.egg
44+
45+
# PyInstaller
46+
# Usually these files are written by a python script from a template
47+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
48+
*.manifest
49+
*.spec
50+
51+
# Installer logs
52+
pip-log.txt
53+
pip-delete-this-directory.txt
54+
55+
# Unit test / coverage reports
56+
htmlcov/
57+
.tox/
58+
.coverage
59+
.cache
60+
nosetests.xml
61+
coverage.xml
62+
63+
# Translations
64+
*.mo
65+
*.pot
66+
67+
# Django stuff:
68+
*.log
69+
70+
# Sphinx documentation
71+
docs/_build/
72+
73+
# PyBuilder
74+
target/
75+
76+
# Virtual environment
77+
.env/
78+
.venv/
79+
venv/
80+
81+
# PyCharm
82+
.idea
83+
84+
# Python mode for VIM
85+
.ropeproject
86+
*/.ropeproject
87+
*/*/.ropeproject
88+
*/*/*/.ropeproject
89+
90+
# Vim swap files
91+
*.swp
92+
*/*.swp
93+
*/*/*.swp
94+
*/*/*/*.swp

.github/workflows/check-style.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Check style
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
# This will trigger the workflow for pull requests to any branch
9+
types: [opened, synchronize, reopened]
10+
11+
jobs:
12+
ruff:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: chartboost/ruff-action@v1
17+
18+
codespell:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: codespell-project/actions-codespell@v1
23+
with:
24+
only_warn: 1
25+
ignore_words_list: ibrary,nd
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Push to Docker Hub
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Remove unnecessary packages
11+
run: |
12+
echo "=== Before pruning ==="
13+
df -h
14+
sudo rm -rf /usr/share/dotnet
15+
sudo rm -rf /usr/local/lib/android
16+
sudo rm -rf /opt/ghc
17+
echo "=== After pruning ==="
18+
df -h
19+
20+
# Link to discussion: https://github.com/orgs/community/discussions/25678
21+
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
with:
25+
submodules: true
26+
27+
- name: Docker meta
28+
id: meta
29+
uses: crazy-max/ghaction-docker-meta@v2
30+
with:
31+
images: |
32+
primeintellect/open_diloco
33+
tags: |
34+
type=ref,event=branch
35+
type=ref,event=pr
36+
type=semver,pattern={{version}}
37+
type=semver,pattern={{major}}.{{minor}}
38+
type=semver,pattern={{major}}
39+
type=sha,prefix=commit-
40+
41+
- name: Set up Docker Buildx
42+
id: buildx
43+
uses: docker/setup-buildx-action@v1
44+
45+
- name: Login to Docker Hub
46+
if: github.event_name != 'pull_request'
47+
uses: docker/login-action@v1
48+
with:
49+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
50+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
51+
52+
- name: Build and push
53+
id: docker_build
54+
uses: docker/build-push-action@v2
55+
with:
56+
context: .
57+
push: ${{ github.event_name != 'pull_request' }}
58+
tags: ${{ steps.meta.outputs.tags }}
59+
60+
- name: Image digest
61+
run: echo ${{ steps.docker_build.outputs.digest }}

.gitignore

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# node and NPM
2+
npm-debug.log
3+
node_modules
4+
5+
# swap files
6+
*~
7+
*.swp
8+
9+
examples/data/*
10+
examples/runs/*
11+
examples/.ipynb_checkpoints/*
12+
13+
env.sh
14+
# Byte-compiled / optimized / DLL files
15+
__pycache__/
16+
*.py[cod]
17+
18+
# C extensions
19+
*.so
20+
21+
# Distribution / packaging
22+
.Python
23+
env/
24+
bin/
25+
build/
26+
develop-eggs/
27+
dist/
28+
eggs/
29+
lib64/
30+
parts/
31+
sdist/
32+
var/
33+
*.egg-info/
34+
.installed.cfg
35+
*.egg/
36+
37+
# Installer logs
38+
pip-log.txt
39+
pip-delete-this-directory.txt
40+
41+
# Unit test / coverage reports
42+
htmlcov/
43+
.tox/
44+
.coverage
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
49+
# Translations
50+
*.mo
51+
52+
# Mr Developer
53+
.mr.developer.cfg
54+
.project
55+
.pydevproject
56+
.idea
57+
.vscode
58+
.ipynb_checkpoints
59+
60+
# Rope
61+
.ropeproject
62+
63+
# Django stuff:
64+
*.log
65+
*.pot
66+
67+
# Sphinx documentation
68+
docs/_build/
69+
docs/tmp*
70+
71+
# OS X garbage
72+
.DS_Store
73+
74+
# Debian things
75+
debian/reproducible-experiment-platform
76+
debian/files
77+
*.substvars
78+
*.debhelper.log
79+
80+
# protobuf stuff
81+
hivemind/proto/*_pb2*
82+
83+
# libp2p-daemon binary
84+
hivemind/hivemind_cli/p2pd

.gitmodules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[submodule "hivemind_source"]
2+
path = hivemind_source
3+
url = https://github.com/PrimeIntellect-ai/hivemind.git
4+
branch = feat-add-downloading-time
5+
[submodule "pydantic_config"]
6+
path = pydantic_config
7+
url = https://github.com/samsja/pydantic_config.git

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.4.7
5+
hooks:
6+
# Run the linter.
7+
- id: ruff
8+
args: [ --fix ]
9+
# Run the formatter.
10+
- id: ruff-format

CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Development workflow
2+
3+
This is the develpment workflow of prime intellect to build upon hivemind
4+
5+
## Install dependencies
6+
7+
Install hivemind
8+
9+
```bash
10+
cd hivemind_source
11+
pip install .
12+
cp build/lib/hivemind/proto/* hivemind/proto/.
13+
pip install -e ".[all]"```
14+
```
15+
16+
## Pre-commit hook
17+
18+
Install the pre commit hook to keep black and isort updated on each commit:
19+
20+
```
21+
pre-commit install
22+
```
23+
24+
## Testing
25+
To run the tests:
26+
27+
```
28+
python -m pytest tests
29+
```
30+
31+
Be sure to actually use python -m otherwise path won't be appended correctly
32+
33+
# Development flags
34+
Add the `PRIME_INTELLECT_DEV` environment variable to your *.bashrc* or *.zshrc* so that development features are enabled.
35+
e.g.
36+
- torch compile error will crash the script instead of silently failing

Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-devel
2+
LABEL maintainer="prime intellect"
3+
LABEL repository="open_diloco"
4+
5+
# Set en_US.UTF-8 locale by default
6+
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment
7+
8+
# Set CUDA_HOME and update PATH
9+
ENV CUDA_HOME=/usr/local/cuda
10+
ENV PATH=$PATH:/usr/local/cuda/bin
11+
12+
# Install packages
13+
RUN apt-get update && apt-get install -y --no-install-recommends --force-yes \
14+
build-essential \
15+
curl \
16+
wget \
17+
git \
18+
vim \
19+
htop \
20+
nvtop \
21+
iperf \
22+
tmux \
23+
openssh-server \
24+
git-lfs \
25+
&& apt-get clean autoclean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
26+
27+
# Install Git LFS
28+
RUN git-lfs install
29+
30+
# Install Rust
31+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
32+
ENV PATH="/root/.cargo/bin:${PATH}"
33+
RUN echo "export PATH=\"/opt/conda/bin:/root/.cargo/bin:\$PATH\"" >> /root/.bashrc
34+
35+
# Install Python dependencies (The gradual copies help with caching)
36+
WORKDIR open_diloco
37+
RUN pip install --pre torchdata --index-url https://download.pytorch.org/whl/nightly/cpu
38+
COPY hivemind_source hivemind_source
39+
RUN pip install --no-cache-dir ./hivemind_source
40+
COPY requirements.txt requirements.txt
41+
RUN pip install --no-cache-dir -r requirements.txt
42+
COPY requirements-dev.txt requirements-dev.txt
43+
RUN pip install --no-cache-dir -r requirements-dev.txt
44+
COPY . .
45+
RUN pip install .
46+
RUN rm -rf ~/.cache/pip

0 commit comments

Comments
 (0)