{ "cells": [ { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "from transformers import pipeline" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Downloading config.json: 100%|██████████| 827/827 [00:00<00:00, 276kB/s]\n", "Downloading model.safetensors: 23%|██▎ | 231M/990M [01:04<03:30, 3.61MB/s] " ] } ], "source": [ "pipe = pipeline(\"text2text-generation\", model=\"samanjoy2/bnpunct_banglat5_seq2seq_finetuned\", device='cpu')" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'বুঝলাম নাহ। তুমার সম্যা কি?'" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "texts = \"বুঝলাম নাহ তুমার সম্যা কি\"\n", "ipas = pipe(texts, max_length=512, batch_size=1)[0]['generated_text']\n", "ipas" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "gputorch_1", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.18" } }, "nbformat": 4, "nbformat_minor": 2 }