Thomas Busath
12/11/2024, 3:35 PMbentoml==1.3.12 . I have a directory with the following structure:
.
├── requirements.txt
└── src
├── __init__.py
├── bentofile.yaml
└── service.py
The service.py looks like this:
from __future__ import annotations
import bentoml
with bentoml.importing():
from transformers import pipeline
EXAMPLE_INPUT = "Breaking News: In an astonishing turn of events, the small town of Willow Creek has been taken by storm as local resident Jerry Thompson's cat, Whiskers, performed what witnesses are calling a 'miraculous and gravity-defying leap.' Eyewitnesses report that Whiskers, an otherwise unremarkable tabby cat, jumped a record-breaking 20 feet into the air to catch a fly. The event, which took place in Thompson's backyard, is now being investigated by scientists for potential breaches in the laws of physics. Local authorities are considering a town festival to celebrate what is being hailed as 'The Leap of the Century."
@bentoml.service
class Summarization:
def __init__(self) -> None:
self.pipeline = pipeline('summarization')
@bentoml.api
def summarize(self, text: str = EXAMPLE_INPUT) -> str:
result = self.pipeline(text)
return f"Hello world! Here's your summary: {result[0]['summary_text']}"
The bentofile.yaml looks like this
service: 'service:Summarization'
labels:
owner: bentoml-team
project: gallery
include:
- '*.py'
python:
packages:
- torch
- transformers
docker:
python_version: "3.10"
The command bentoml build -f ./src/bentofile.yaml ./src/ works with bentoml==1.3.11 but not with bentoml==1.3.12 . Has the cli changed?Jian Shen Yap
12/12/2024, 1:33 AMFrost Ming
12/12/2024, 2:09 AMThomas Busath
12/12/2024, 4:36 PMShihgian Lee
12/12/2024, 4:38 PM