This file contains hidden or 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
clearml-serving --id <your_service_ID> model add --engine triton \ | |
--endpoint "transformer_model" \ | |
--model-id <your_model_ID> \ | |
--preprocess examples/huggingface/preprocessing.py \ | |
--input-size "[-1]" "[-1]" "[-1]" \ | |
--input-type int32 int32 int32 \ | |
--input-name "input_ids" "token_type_ids" "attention_mask" \ | |
--output-size "[2]" \ | |
--output-type float32 \ | |
--output-name "output" \ |
This file contains hidden or 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
clearml-serving --id <your_service_ID> model upload --name "Transformer ONNX" --project "Hugginface Serving" --path triton_models/transformer_tensorrt_model/1/model.bin |
This file contains hidden or 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
# Convert a Huggingface model to ONNX | |
docker run -it --rm --gpus all \ | |
-v $PWD:/project ghcr.io/els-rd/transformer-deploy:0.5.1 \ | |
bash -c "cd /project && \ | |
convert_model -m \"philschmid/MiniLM-L6-H384-uncased-sst2\" \ | |
--backend tensorrt onnx \ | |
--seq-len 16 128 128" | |
# This will have outputted a triton_models/ folder, | |
# which we can now serve using Triton |
This file contains hidden or 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
import torch | |
from fastapi import FastAPI | |
from transformers import AutoTokenizer, BatchEncoding, TensorType, AutoModelForSequenceClassification | |
application = FastAPI() | |
tokenizer = AutoTokenizer.from_pretrained("philschmid/MiniLM-L6-H384-uncased-sst2") | |
model = AutoModelForSequenceClassification.from_pretrained("philschmid/MiniLM-L6-H384-uncased-sst2").to('cuda:0') | |
This file contains hidden or 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
# ... | |
# Loggers | |
data_dict = None | |
if RANK in {-1, 0}: | |
loggers = Loggers(save_dir, weights, opt, hyp, LOGGER) # loggers instance | |
if loggers.clearml: | |
loggers.clearml.task.execute_remotely(queue='my_queue') # <------ ADD THIS LINE | |
# Data_dict is either None is user did not choose for ClearML dataset or is filled in by ClearML | |
data_dict = loggers.clearml.data_dict | |
# ... |
This file contains hidden or 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
clearml-agent daemon --queue <queues_to_listen_to> [--docker] |
This file contains hidden or 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
python train.py --img 640 --batch 16 --epochs 3 --data clearml://<your_dataset_id> --weights yolov5s.pt --cache |
This file contains hidden or 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
# Optionally add --parent <parent_dataset_id> if you want to base | |
# this version on another dataset version, so no duplicate files are uploaded! | |
clearml-data create --name coco128 --project YOLOv5 | |
clearml-data add --files . | |
clearml-data close |
This file contains hidden or 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
cd coco128 | |
clearml-data sync --project YOLOv5 --name coco128 --folder . |
This file contains hidden or 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
.. | |
|_ yolov5 | |
|_ datasets | |
|_ coco128 | |
|_ images | |
|_ labels | |
|_ coco128.yaml # <---- HERE! | |
|_ LICENSE | |
|_ README.txt |
NewerOlder