{ "cells": [ { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "import torch\n", "import pickle\n", "from language import Language\n", "from utility import Encoder, Decoder, encoderBlock, decoderBlock, MultiHeadAttention, Head, FeedForward\n", "import warnings\n", "from typing import List\n", "warnings.filterwarnings(\"ignore\", category=FutureWarning)\n" ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['लॉक्सलाक्राक्यालालासी']" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "s = 'a' * 1\n", "generate([s])" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'^थ्रालाष्राप्टोार्फ्रास्रफ्फ्फ्'" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "output_lang.decode(o.tolist()[0])" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "tensor([20, 4, 5, 12, 4, 3])" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "s = \"pankaj\"\n", "torch.tensor(input_lang.encode(s), device=device, dtype=torch.long)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7864\n", "\n", "Could not create share link. Please check your internet connection or our status page: https://status.gradio.app.\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "