from transformers import pipeline | |
classifier = pipeline("pair-classification", model="sgugger/finetuned-bert-mrpc") | |
Then we can share it on the Hub by using the save_pretrained method in a Repository: | |
from huggingface_hub import Repository | |
repo = Repository("test-dynamic-pipeline", clone_from="{your_username}/test-dynamic-pipeline") | |
classifier.save_pretrained("test-dynamic-pipeline") | |
repo.push_to_hub() | |
This will copy the file where you defined PairClassificationPipeline inside the folder "test-dynamic-pipeline", | |
along with saving the model and tokenizer of the pipeline, before pushing everything into the repository | |
{your_username}/test-dynamic-pipeline. |