-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
4 changed files
with
97 additions
and
41 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,7 @@ | ||
FROM vespaengine/vespa:latest | ||
|
||
RUN echo '#!/usr/bin/env bash' > /entry.sh | ||
RUN echo 'exec "$@"' >> /entry.sh | ||
RUN chmod +x /entry.sh | ||
# ENTRYPOINT /entry.sh | ||
ENTRYPOINT tail -f /dev/null |
Binary file not shown.
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,38 @@ | ||
import modal | ||
|
||
|
||
# vespa_image = modal.Image.from_registry("vespaengine/vespa", add_python="3.11") | ||
vespa_image = modal.Image.from_dockerfile("Dockerfile", add_python="3.11") | ||
app = modal.App("dankvespa", image=vespa_image) | ||
|
||
@modal.web_endpoint(method="POST", docs=True) | ||
@app.cls( | ||
enable_memory_snapshot=True, | ||
# volumes={"/my_vol": modal.Volume.from_name("my-test-volume")} | ||
) | ||
class Vespa: | ||
@modal.build() | ||
def build(self): | ||
# cache | ||
print("build") | ||
|
||
@modal.enter(snap=True) | ||
def load(self): | ||
# Create a memory snapshot with the model loaded in CPU memory. | ||
print("save state") | ||
|
||
@modal.enter(snap=False) | ||
def setup(self): | ||
# Move the model to a GPU before doing any work. | ||
print("loaded from snapshot") | ||
|
||
@modal.method() | ||
def search(self, query: str): | ||
print("search") | ||
|
||
|
||
@app.local_entrypoint() | ||
async def main(): | ||
# score the messages | ||
m1 = await Vespa().search.remote.aio("test") | ||
print(m1) |