-
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.
Merge pull request #8 from janhq/dev/bach
Dev/bach
- Loading branch information
Showing
8 changed files
with
210 additions
and
86 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,51 @@ | ||
FROM python:3.11-slim | ||
|
||
# Install necessary packages | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
cmake \ | ||
sudo \ | ||
unzip \ | ||
curl \ | ||
wget \ | ||
git \ | ||
git-lfs \ | ||
jq \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ | ||
unzip awscliv2.zip && \ | ||
./aws/install | ||
|
||
ENV HOME=/home/runner | ||
|
||
RUN mkdir -p /home/runner | ||
|
||
ARG RUNNER_VERSION=2.317.0 | ||
|
||
ARG RUNNER_UID=1000 | ||
ARG DOCKER_GID=1001 | ||
|
||
RUN adduser --disabled-password --gecos "" --uid $RUNNER_UID runner \ | ||
&& groupadd docker --gid $DOCKER_GID \ | ||
&& usermod -aG sudo runner \ | ||
&& usermod -aG docker runner \ | ||
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \ | ||
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers | ||
|
||
# cd into the user directory, download and unzip the github actions runner | ||
RUN cd /home/runner && mkdir actions-runner && cd actions-runner \ | ||
&& curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \ | ||
&& tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz | ||
|
||
RUN chown -R runner:runner /home/runner && /home/runner/actions-runner/bin/installdependencies.sh | ||
|
||
ADD ./start.sh /home/runner/start.sh | ||
|
||
RUN chmod +x /home/runner/start.sh | ||
|
||
ENTRYPOINT ["/bin/bash", "/home/runner/start.sh"] | ||
|
||
USER runner |
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,21 @@ | ||
#!/bin/bash | ||
|
||
RUNNER_REPO=$RUNNER_REPO | ||
RUNNER_PAT=$RUNNER_PAT | ||
RUNNER_GROUP=$RUNNER_GROUP | ||
RUNNER_LABELS=$RUNNER_LABELS | ||
RUNNER_NAME=$(hostname) | ||
|
||
cd /home/runner/actions-runner | ||
|
||
./config.sh --unattended --replace --url https://github.com/${RUNNER_REPO} --pat ${RUNNER_PAT} --name ${RUNNER_NAME} --runnergroup ${RUNNER_GROUP} --labels ${RUNNER_LABELS} --work /home/runner/actions-runner/_work | ||
|
||
cleanup() { | ||
echo "Removing runner..." | ||
./config.sh remove --unattended --pat ${RUNNER_PAT} | ||
} | ||
|
||
trap 'cleanup; exit 130' INT | ||
trap 'cleanup; exit 143' TERM | ||
|
||
./run.sh & wait $! |
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,27 @@ | ||
name: CI/CD Test | ||
|
||
on: | ||
push: | ||
branches: main | ||
pull_request: | ||
branches: main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: research-utils | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e . | ||
- name: Run test_flow.py | ||
run: python test_flows.py | ||
env: | ||
S3_ACCESS_KEY: ${{ secrets.MINIO_ACCESS_KEY_ID }} | ||
S3_SECRET_KEY: ${{ secrets.MINIO_SECRET_ACCESS_KEY }} | ||
S3_ENDPOINT_URL: ${{ secrets.MINIO_ENDPOINT }} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export S3_ACCESS_KEY=minioadmin | ||
export S3_SECRET_KEY=minioadmin | ||
export S3_ENDPOINT_URL=http://127.0.0.1:9000 | ||
export S3_ENDPOINT_URL="http://127.0.0.1:9000" | ||
mc alias set ALIAS $S3_ENDPOINT_URL $S3_ACCESS_KEY $S3_SECRET_KEY |
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
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
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,20 @@ | ||
from s3helper import S3Helper,S3HelperAutoConfig,S3HelperAutoTokenizer,S3HelperAutoModelForCausalLM, s3_load_dataset | ||
import os | ||
import logging | ||
|
||
# os.environ['S3_ACCESS_KEY'] = 'minioadmin' | ||
# os.environ['S3_SECRET_KEY'] = 'minioadmin' | ||
# os.environ['S3_ENDPOINT_URL'] = 'http://172.17.0.2:9000' | ||
S3Helper() | ||
|
||
# # Example usage | ||
model_name = "jan-hq-test/tokenizer-tinyllama" | ||
# model = S3HelperAutoModelForCausalLM.from_pretrained(model_name) | ||
tokenizer = S3HelperAutoTokenizer.from_pretrained(model_name) | ||
logging.info(f"Tokenizer Loading successful: {tokenizer}") | ||
# print(tokenizer) | ||
# config = S3HelperAutoConfig.from_pretrained(model_name) | ||
# Make sure S3Helper is initialized and environment variables are set | ||
# Load a dataset from S3 bucket | ||
dataset = s3_load_dataset("jan-hq-test/test-dataset",file_format='parquet', split='train') | ||
logging.info(f"Dataset Loading successful") |