Skip to content

Commit

Permalink
Merge pull request #25 from beclab/feat/bertv3-embedding
Browse files Browse the repository at this point in the history
feat: add bert v3 embedding
  • Loading branch information
bleachzou3 authored Aug 7, 2024
2 parents 6c0cd33 + a898612 commit 0babfb8
Show file tree
Hide file tree
Showing 14 changed files with 267 additions and 83 deletions.
90 changes: 61 additions & 29 deletions .github/workflows/update_r4userembedding.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,65 @@
name: Update Userembedding
name: Publish to Dockerhub ( userembedding )

on:
workflow_dispatch:
inputs:
tags:
description: 'Release Tags'
workflow_dispatch:
inputs:
tags:
description: 'Release Tags'

jobs:
update_userembedding:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
push: true
tags: beclab/r4userembedding:${{ github.event.inputs.tags }}
file: Dockerfile.r4userembedding
platforms: linux/amd64,linux/arm64
publish_dockerhub_amd64:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Build r4userembedding and push Docker image
uses: docker/build-push-action@v3
with:
push: true
tags: beclab/r4userembedding:${{ github.event.inputs.tags }}-amd64
file: Dockerfile.r4userembedding
platforms: linux/amd64

publish_dockerhub_arm64:
runs-on: self-hosted
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Build r4userembedding and push Docker image
uses: docker/build-push-action@v3
with:
push: true
tags: beclab/r4userembedding:${{ github.event.inputs.tags }}-arm64
file: Dockerfile.r4userembedding
platforms: linux/arm64

publish_manifest:
needs:
- publish_dockerhub_amd64
- publish_dockerhub_arm64
runs-on: ubuntu-latest
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Push manifest
run: |
docker manifest create beclab/r4userembedding:${{ github.event.inputs.tags }} --amend beclab/r4userembedding:${{ github.event.inputs.tags }}-amd64 --amend beclab/r4userembedding:${{ github.event.inputs.tags }}-arm64
docker manifest push beclab/r4userembedding:${{ github.event.inputs.tags }}
14 changes: 7 additions & 7 deletions Dockerfile.r4userembedding
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:jammy As builder

# RUN apk add openssl-dev musl-dev g++

RUN mkdir -p /bertv2userembedding && \
RUN mkdir -p /userembedding && \
apt update && \
apt install curl -y && \
curl https://sh.rustup.rs -sSf | bash -s -- -y && \
Expand All @@ -12,9 +12,9 @@ RUN mkdir -p /bertv2userembedding && \
apt-get install pkg-config -y

ENV PATH="/root/.cargo/bin:${PATH}"
WORKDIR /bertv2userembedding
COPY user-embedding/src /bertv2userembedding/src
COPY user-embedding/Cargo.toml /bertv2userembedding/Cargo.toml
WORKDIR /userembedding
COPY user-embedding/src /userembedding/src
COPY user-embedding/Cargo.toml /userembedding/Cargo.toml
RUN cargo build --release


Expand All @@ -24,10 +24,10 @@ FROM ubuntu:jammy
# Import from builder.


WORKDIR /bertv2userembedding
WORKDIR /userembedding

# Copy our build
COPY --from=builder /bertv2userembedding/target/release/bertv2userembedding ./
COPY --from=builder /userembedding/target/release/ ./


CMD ["/bertv2userembedding/bertv2userembedding"]
CMD ["/userembedding/userembedding"]
86 changes: 82 additions & 4 deletions user-embedding/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions user-embedding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ tokio = {version = "1.33.0",features = ["full"]}
ndarray = "0.15.6"
ndarray-rand = "0.14.0"
reqwest = {version="0.11.23",features = ["json"] }
time = "0.3.36"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"

[[bin]]
name = "bertv2userembedding"
path = "src/bertv2_userembedding.rs"
name = "userembedding"
path = "src/userembedding.rs"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:jammy As builder

# RUN apk add openssl-dev musl-dev g++

RUN mkdir -p /bertv2userembedding && \
RUN mkdir -p /userembedding && \
apt update && \
apt install curl -y && \
curl https://sh.rustup.rs -sSf | bash -s -- -y && \
Expand All @@ -12,9 +12,9 @@ RUN mkdir -p /bertv2userembedding && \
apt-get install pkg-config -y

ENV PATH="/root/.cargo/bin:${PATH}"
WORKDIR /bertv2userembedding
COPY user-embedding/src /bertv2userembedding/src
COPY user-embedding/Cargo.toml /bertv2userembedding/Cargo.toml
WORKDIR /userembedding
COPY user-embedding/src /userembedding/src
COPY user-embedding/Cargo.toml /userembedding/Cargo.toml
RUN cargo build --release


Expand All @@ -24,10 +24,10 @@ FROM ubuntu:jammy
# Import from builder.


WORKDIR /bertv2userembedding
WORKDIR /userembedding

# Copy our build
COPY --from=builder /bertv2userembedding/target/release/bertv2userembedding ./
COPY --from=builder /userembedding/target/release/ ./


CMD ["/bertv2userembedding/bertv2userembedding"]
CMD ["/userembedding/userembedding"]
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ PREFIX=beclab

docker build \
-f ${DOCKER_FILE_PATH} \
-t ${PREFIX}/bertv2userembedding $root_dir
-t ${PREFIX}/userembedding $root_dir
Loading

0 comments on commit 0babfb8

Please sign in to comment.