-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9576e08
Showing
33 changed files
with
4,697 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# syntax=docker/dockerfile:1.3 | ||
FROM llm_tools-core:latest as llm_tools-dev | ||
# syntax=docker/dockerfile:1.3 | ||
ENV EDITOR=vim | ||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
ARG PIP_VERSION=23.3.2 | ||
|
||
|
||
ARG USER_NAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=1000 | ||
|
||
RUN apt-get update && apt-get install -y sudo && \ | ||
apt-get autoremove -y && apt-get clean && rm -rf /tmp/* /var/tmp/* && rm -rf /var/lib/apt/lists/* && \ | ||
groupadd --gid $USER_GID $USER_NAME && \ | ||
useradd --uid $USER_UID --gid $USER_GID -m $USER_NAME && \ | ||
usermod -aG sudo $USER_NAME && \ | ||
echo $USER_NAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USER_NAME && \ | ||
chmod 0440 /etc/sudoers.d/$USER_NAME | ||
|
||
ENV SHELL=/usr/bin/zsh | ||
RUN chsh $USER_NAME -s $SHELL | ||
|
||
|
||
# Install dev dependences & tools | ||
RUN apt-get update && apt-get install -y \ | ||
htop \ | ||
vim \ | ||
apt-transport-https \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg \ | ||
lsb-release \ | ||
ssh \ | ||
rsync \ | ||
kmod \ | ||
unzip \ | ||
acl \ | ||
zsh \ | ||
git \ | ||
make \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean \ | ||
&& rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* | ||
|
||
WORKDIR /tmp | ||
|
||
|
||
# Install docker | ||
RUN curl -fsSL https://get.docker.com -o get-docker.sh \ | ||
&& sh ./get-docker.sh \ | ||
&& usermod -aG docker $USER_NAME | ||
|
||
|
||
# install act (github actions local runner) | ||
# https://nektosact.com/introduction.html | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/nektos/act/master/install.sh | bash && \ | ||
mv bin/act /usr/local/bin/act | ||
|
||
|
||
COPY ./pyproject.toml ./poetry.lock* /tmp/ | ||
RUN --mount=type=cache,target=/root/.cache/poetry \ | ||
poetry export --format requirements.txt --without-hashes --only dev --output dev-requirements.txt && \ | ||
pip install -r dev-requirements.txt | ||
|
||
|
||
USER vscode | ||
RUN poetry config virtualenvs.create false | ||
RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | ||
|
||
# Custom Zsh configurations | ||
RUN echo "autoload bashcompinit && bashcompinit" >> ~/.zshrc && \ | ||
echo "autoload -Uz compinit && compinit" >> ~/.zshrc && \ | ||
echo "sudo setfacl -m u:vscode:rw /var/run/docker.sock" >> ~/.zshrc && \ | ||
echo '[ -f ".env" ] || echo -e "" > .env && export $(grep -v "^#" .env | xargs)' >> ~/.zshrc | ||
|
||
COPY .devcontainer/entrypoint.sh /home/$USER_NAME/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.183.0/containers/python-3 | ||
{ | ||
"name": "llm_tools", | ||
"initializeCommand": "make core-build", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "devcontainer", | ||
"runServices": [ | ||
"devcontainer" | ||
], | ||
"workspaceFolder": "/workspace", | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"python.languageServer": "Pylance", | ||
"editor.formatOnSave": true, | ||
"python.formatting.provider": "none", | ||
"python.formatting.blackArgs": [ | ||
"--line-length=88" | ||
], | ||
"python.linting.enabled": true, | ||
"python.linting.flake8Path": "/usr/local/bin/flake8", | ||
"python.linting.pylintArgs": [ | ||
"--generate-members" | ||
], | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.black-formatter", | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
} | ||
}, | ||
"isort.args": [ | ||
"--profile", | ||
"black" | ||
], | ||
"files.trimFinalNewlines": true, | ||
"files.trimTrailingWhitespace": true, | ||
"files.watcherExclude": { | ||
"**/.git/objects/**": true, | ||
"**/.git/subtree-cache/**": true | ||
} | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-python.python", | ||
"magicstack.magicpython", | ||
"ms-python.black-formatter", | ||
"ms-python.isort", | ||
"eamodio.gitlens", | ||
"GitHub.copilot", | ||
"GitHub.copilot-labs", | ||
"charliermarsh.ruff", | ||
] | ||
} | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "bash /home/vscode/entrypoint.sh", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
version: "3.8" | ||
services: | ||
devcontainer-gpu: | ||
network_mode: host | ||
image: llm_tools-devcontainer | ||
container_name: llm_tools-devcontainer-gpu | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
args: | ||
- USER_NAME=vscode | ||
- USER_UID=1000 | ||
- USER_GID=1000 | ||
env_file: ../.env | ||
|
||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- capabilities: [ gpu ] | ||
shm_size: "8gb" | ||
volumes: | ||
- ..:/workspace:cached | ||
- ../notebooks/:/notebooks | ||
- ../resources/:/resources | ||
- $HOME/.ssh/:/home/vscode/.ssh | ||
- $HOME/.gitconfig:/home/vscode/.gitconfig | ||
command: /bin/sh -c "while sleep 1000; do :; done" | ||
|
||
devcontainer: | ||
network_mode: host | ||
image: llm_tools-devcontainer | ||
container_name: llm_tools-devcontainer-cpu | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
args: | ||
- USER_NAME=vscode | ||
- USER_UID=1000 | ||
- USER_GID=1000 | ||
env_file: ../.env | ||
shm_size: "8gb" | ||
volumes: | ||
- ..:/workspace:cached | ||
- ../notebooks/:/notebooks | ||
- ../resources/:/resources | ||
- $HOME/.ssh/:/home/vscode/.ssh | ||
- $HOME/.gitconfig:/home/vscode/.gitconfig | ||
command: /bin/sh -c "while sleep 1000; do :; done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/env sh | ||
|
||
# install src packages | ||
sudo pip install --no-deps -e /workspace/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Exclude the environment file | ||
.env* | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# 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/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
|
||
# Database | ||
*.db | ||
*.rdb | ||
|
||
# Pycharm | ||
.idea | ||
|
||
# VS Code | ||
.vscode/ | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/ | ||
workspace.xml | ||
|
||
# Spyder | ||
.spyproject/ | ||
|
||
# Jupyter NB Checkpoints | ||
.ipynb_checkpoints/ | ||
|
||
# exclude data from source control by default | ||
/data/ | ||
|
||
# Mac OS-specific storage files | ||
.DS_Store | ||
|
||
# vim | ||
*.swp | ||
*.swo | ||
|
||
# Mypy cache | ||
.mypy_cache/ | ||
|
||
|
||
notebooks/chroma_cache/* | ||
|
||
resources/ | ||
!resources/.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
The MIT License (MIT) | ||
Copyright (c) 2024, author | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
$(shell touch .env) | ||
include .env | ||
export $(shell sed 's/=.*//' .env) | ||
|
||
|
||
core-build: | ||
docker compose build llm_tools-core | ||
|
||
|
||
weaviate-start: | ||
docker compose up -d weaviate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
llm tools | ||
============================== | ||
|
||
A short description of the project. | ||
|
||
# Development | ||
|
||
Project Organization | ||
------------ | ||
|
||
``` | ||
. | ||
├── build -> Docker building files & utils | ||
│ └── core | ||
├── notebooks -> Notebooks with experimentes and examples | ||
│ └── ... | ||
├── reports -> Reports generated by results from | ||
| | ||
├── resources -> general resources: models, datasets, cache, etc | ||
│ ├── cache | ||
│ ├── models | ||
│ ├── datasets | ||
│ └── ... | ||
├── scripts -> utils | ||
└── llm_tools -> main package | ||
``` | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- [Docker](https://docs.docker.com/) | ||
|
||
**NOTE**: personal API keys and credentials should be stored in a `.env` file in the `.secrets` directory, under the root directory of the project. | ||
|
||
The `.env` file should be in the following format: | ||
|
||
|
||
### Installation | ||
1. Clone the repository: | ||
``` | ||
git clone git repo url to clone it | ||
``` | ||
|
||
2. Install the lastest version of [Make](https://www.gnu.org/software/make/): | ||
```bash | ||
$ sudo apt update | ||
$ sudo apt install make | ||
``` | ||
|
||
3. Install the lastest version of [Docker](https://docs.docker.com/engine/install/) | ||
|
||
|
||
### VS Code development environment | ||
1. Install the [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension for [VS Code](https://code.visualstudio.com/). | ||
2. Open the project in VS Code. | ||
3. Click on the green button in the bottom left corner of the VS Code window and select the `Reopen in Container` option. Alternatively, you can run the `Remote-Containers: Reopen in Container` command from the Command Palette (`Ctrl+Shift+P`). | ||
4. VS Code will automatically build the Docker images and start the containers. This may take a few minutes. Once the containers are up and running, you can start developing in the VS Code development environment. | ||
|
||
## Contributors | ||
- author - [@author](https://github.com/author) at [collective.ai](https://collectiveai.io) ([email](mailto:[email protected])) | ||
|
||
|
||
## Contributing | ||
We welcome contributions to llm tools Feel free to submit a pull request with your changes or open an issue if you have any questions or suggestions. |
Oops, something went wrong.