-
Notifications
You must be signed in to change notification settings - Fork 831
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): [SCv1] Automatically create and upload a custom HF model …
…to seldon-models in GCS on every version release (#5104) * V2D-1258 Create and upload a custom HF model to seldon-models in GCS * Remove left over link for kfserving storage initialiser * Change GCS location to make it obvious it is a custom hf model
- Loading branch information
Showing
7 changed files
with
47 additions
and
3 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
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,2 @@ | ||
.env/ | ||
text-generation-model-artefacts/ |
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,16 @@ | ||
VERSION := $(shell cat ../../../../version.txt) | ||
|
||
all: env train upload | ||
|
||
model: env train | ||
|
||
env: | ||
python3 -m venv .env | ||
./.env/bin/pip install --upgrade pip setuptools | ||
./.env/bin/pip install -r requirements.txt | ||
|
||
train: | ||
.env/bin/python train.py | ||
|
||
upload: | ||
gsutil cp -r text-generation-model-artefacts/* gs://seldon-models/v${VERSION}/huggingface/custom-text-generation/ |
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,3 @@ | ||
seldon_core | ||
transformers >=4.30,<4.32 | ||
tensorflow == 2.12.0 |
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,19 @@ | ||
from transformers import ( | ||
GPT2Tokenizer, | ||
TFGPT2LMHeadModel, | ||
pipeline, | ||
) | ||
|
||
|
||
def main() -> None: | ||
tokenizer = GPT2Tokenizer.from_pretrained("gpt2") | ||
model = TFGPT2LMHeadModel.from_pretrained("gpt2") | ||
|
||
p = pipeline(task="text-generation", model=model, tokenizer=tokenizer) | ||
|
||
p.save_pretrained("text-generation-model-artefacts") | ||
|
||
|
||
if __name__ == "__main__": | ||
print("Building a custom HuggingFace model...") | ||
main() |