Skip to content

Commit

Permalink
feat: ported Dockerfile to modal api
Browse files Browse the repository at this point in the history
  • Loading branch information
limcheekin committed Jul 13, 2024
1 parent 4e87466 commit 3546087
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions open/text/embeddings/server/modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

app = App(os.environ["APP_NAME"])

image = Image.from_dockerfile(
"Dockerfile-Modal",
force_build=True,
build_args={
"MODEL": os.environ["MODEL"],
"HOME": os.environ["HOME"],
}
).env({
"MODEL": os.environ["MODEL"],
"NORMALIZE_EMBEDDINGS": os.environ["NORMALIZE_EMBEDDINGS"],
"VERBOSE": os.environ["VERBOSE"],
"HF_HOME": "/tmp/hf_home",
})
image = Image.from_registry("python:3.11-slim-bookworm"
).copy_local_file(local_path: f"{os.environ["HOME"]}/download.sh"
).dockerfile_commands(
"RUN apt-get update && apt-get install -y git-lfs",
f"RUN chmod +x *.sh && ./download.sh {os.environ["MODEL"]}"
).pip_install("open-text-embeddings[server]"
).env({
"MODEL": os.environ["MODEL"],
"NORMALIZE_EMBEDDINGS": os.environ["NORMALIZE_EMBEDDINGS"],
"VERBOSE": os.environ["VERBOSE"],
"HF_HOME": "/tmp/hf_home",
})


cpu = float(os.getenv("CPU", 2.0))
memory = int(os.getenv("MEMORY", 2048))
Expand Down

0 comments on commit 3546087

Please sign in to comment.