sarch7040 commited on
Commit
1e88a93
·
1 Parent(s): 33307cf

Deploying app on hiugginface spaces

Browse files
Dockerfile ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim-bullseye
2
+
3
+ WORKDIR /app
4
+
5
+ COPY . /app/
6
+
7
+ # Upgrade pip
8
+ RUN pip install --upgrade pip
9
+
10
+ # Install system dependencies for scientific libraries
11
+ RUN apt-get update && apt-get install -y \
12
+ build-essential \
13
+ cmake \
14
+ libopenblas-dev \
15
+ liblapack-dev \
16
+ libjpeg-dev \
17
+ zlib1g-dev \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # Install Python dependencies
21
+ RUN pip install torch torchvision numpy scipy pandas matplotlib scikit-learn flask transformers
22
+
23
+ EXPOSE 3000
24
+
25
+ CMD ["python", "./app.py"]
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Sarvesh Chaudhari
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
Model Training/final-method-using-m2m100.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":9585160,"sourceType":"datasetVersion","datasetId":5845201}],"dockerImageVersionId":30786,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"from datasets import load_dataset","metadata":{"execution":{"iopub.status.busy":"2024-10-13T03:59:54.293786Z","iopub.execute_input":"2024-10-13T03:59:54.294192Z","iopub.status.idle":"2024-10-13T03:59:56.257624Z","shell.execute_reply.started":"2024-10-13T03:59:54.294138Z","shell.execute_reply":"2024-10-13T03:59:56.256580Z"},"trusted":true},"execution_count":1,"outputs":[]},{"cell_type":"code","source":"!pip install sentencepiece\n!pip install transformers\n!pip install datasets evaluate\n!pip install sacrebleu","metadata":{"execution":{"iopub.status.busy":"2024-10-13T03:59:56.261528Z","iopub.execute_input":"2024-10-13T03:59:56.261989Z","iopub.status.idle":"2024-10-13T04:00:47.093610Z","shell.execute_reply.started":"2024-10-13T03:59:56.261955Z","shell.execute_reply":"2024-10-13T04:00:47.092408Z"},"trusted":true},"execution_count":2,"outputs":[{"name":"stdout","text":"Requirement already satisfied: sentencepiece in /opt/conda/lib/python3.10/site-packages (0.2.0)\nRequirement already satisfied: transformers in /opt/conda/lib/python3.10/site-packages (4.45.1)\nRequirement already satisfied: filelock in /opt/conda/lib/python3.10/site-packages (from transformers) (3.15.1)\nRequirement already satisfied: huggingface-hub<1.0,>=0.23.2 in /opt/conda/lib/python3.10/site-packages (from transformers) (0.25.1)\nRequirement already satisfied: numpy>=1.17 in /opt/conda/lib/python3.10/site-packages (from transformers) (1.26.4)\nRequirement already satisfied: packaging>=20.0 in /opt/conda/lib/python3.10/site-packages (from transformers) (21.3)\nRequirement already satisfied: pyyaml>=5.1 in /opt/conda/lib/python3.10/site-packages (from transformers) (6.0.2)\nRequirement already satisfied: regex!=2019.12.17 in /opt/conda/lib/python3.10/site-packages (from transformers) (2024.5.15)\nRequirement already satisfied: requests in /opt/conda/lib/python3.10/site-packages (from transformers) (2.32.3)\nRequirement already satisfied: safetensors>=0.4.1 in /opt/conda/lib/python3.10/site-packages (from transformers) (0.4.5)\nRequirement already satisfied: tokenizers<0.21,>=0.20 in /opt/conda/lib/python3.10/site-packages (from transformers) (0.20.0)\nRequirement already satisfied: tqdm>=4.27 in /opt/conda/lib/python3.10/site-packages (from transformers) (4.66.4)\nRequirement already satisfied: fsspec>=2023.5.0 in /opt/conda/lib/python3.10/site-packages (from huggingface-hub<1.0,>=0.23.2->transformers) (2024.6.1)\nRequirement already satisfied: typing-extensions>=3.7.4.3 in /opt/conda/lib/python3.10/site-packages (from huggingface-hub<1.0,>=0.23.2->transformers) (4.12.2)\nRequirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /opt/conda/lib/python3.10/site-packages (from packaging>=20.0->transformers) (3.1.2)\nRequirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.10/site-packages (from requests->transformers) (3.3.2)\nRequirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.10/site-packages (from requests->transformers) (3.7)\nRequirement already satisfied: urllib3<3,>=1.21.1 in /opt/conda/lib/python3.10/site-packages (from requests->transformers) (1.26.18)\nRequirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.10/site-packages (from requests->transformers) (2024.8.30)\nRequirement already satisfied: datasets in /opt/conda/lib/python3.10/site-packages (3.0.1)\nCollecting evaluate\n Downloading evaluate-0.4.3-py3-none-any.whl.metadata (9.2 kB)\nRequirement already satisfied: filelock in /opt/conda/lib/python3.10/site-packages (from datasets) (3.15.1)\nRequirement already satisfied: numpy>=1.17 in /opt/conda/lib/python3.10/site-packages (from datasets) (1.26.4)\nRequirement already satisfied: pyarrow>=15.0.0 in /opt/conda/lib/python3.10/site-packages (from datasets) (16.1.0)\nRequirement already satisfied: dill<0.3.9,>=0.3.0 in /opt/conda/lib/python3.10/site-packages (from datasets) (0.3.8)\nRequirement already satisfied: pandas in /opt/conda/lib/python3.10/site-packages (from datasets) (2.2.2)\nRequirement already satisfied: requests>=2.32.2 in /opt/conda/lib/python3.10/site-packages (from datasets) (2.32.3)\nRequirement already satisfied: tqdm>=4.66.3 in /opt/conda/lib/python3.10/site-packages (from datasets) (4.66.4)\nRequirement already satisfied: xxhash in /opt/conda/lib/python3.10/site-packages (from datasets) (3.4.1)\nRequirement already satisfied: multiprocess in /opt/conda/lib/python3.10/site-packages (from datasets) (0.70.16)\nRequirement already satisfied: fsspec<=2024.6.1,>=2023.1.0 in /opt/conda/lib/python3.10/site-packages (from fsspec[http]<=2024.6.1,>=2023.1.0->datasets) (2024.6.1)\nRequirement already satisfied: aiohttp in /opt/conda/lib/python3.10/site-packages (from datasets) (3.9.5)\nRequirement already satisfied: huggingface-hub>=0.22.0 in /opt/conda/lib/python3.10/site-packages (from datasets) (0.25.1)\nRequirement already satisfied: packaging in /opt/conda/lib/python3.10/site-packages (from datasets) (21.3)\nRequirement already satisfied: pyyaml>=5.1 in /opt/conda/lib/python3.10/site-packages (from datasets) (6.0.2)\nRequirement already satisfied: aiosignal>=1.1.2 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets) (1.3.1)\nRequirement already satisfied: attrs>=17.3.0 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets) (23.2.0)\nRequirement already satisfied: frozenlist>=1.1.1 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets) (1.4.1)\nRequirement already satisfied: multidict<7.0,>=4.5 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets) (6.0.5)\nRequirement already satisfied: yarl<2.0,>=1.0 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets) (1.9.4)\nRequirement already satisfied: async-timeout<5.0,>=4.0 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets) (4.0.3)\nRequirement already satisfied: typing-extensions>=3.7.4.3 in /opt/conda/lib/python3.10/site-packages (from huggingface-hub>=0.22.0->datasets) (4.12.2)\nRequirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /opt/conda/lib/python3.10/site-packages (from packaging->datasets) (3.1.2)\nRequirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.10/site-packages (from requests>=2.32.2->datasets) (3.3.2)\nRequirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.10/site-packages (from requests>=2.32.2->datasets) (3.7)\nRequirement already satisfied: urllib3<3,>=1.21.1 in /opt/conda/lib/python3.10/site-packages (from requests>=2.32.2->datasets) (1.26.18)\nRequirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.10/site-packages (from requests>=2.32.2->datasets) (2024.8.30)\nRequirement already satisfied: python-dateutil>=2.8.2 in /opt/conda/lib/python3.10/site-packages (from pandas->datasets) (2.9.0.post0)\nRequirement already satisfied: pytz>=2020.1 in /opt/conda/lib/python3.10/site-packages (from pandas->datasets) (2024.1)\nRequirement already satisfied: tzdata>=2022.7 in /opt/conda/lib/python3.10/site-packages (from pandas->datasets) (2024.1)\nRequirement already satisfied: six>=1.5 in /opt/conda/lib/python3.10/site-packages (from python-dateutil>=2.8.2->pandas->datasets) (1.16.0)\nDownloading evaluate-0.4.3-py3-none-any.whl (84 kB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m84.0/84.0 kB\u001b[0m \u001b[31m2.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[?25hInstalling collected packages: evaluate\nSuccessfully installed evaluate-0.4.3\nCollecting sacrebleu\n Downloading sacrebleu-2.4.3-py3-none-any.whl.metadata (51 kB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m51.8/51.8 kB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[?25hCollecting portalocker (from sacrebleu)\n Downloading portalocker-2.10.1-py3-none-any.whl.metadata (8.5 kB)\nRequirement already satisfied: regex in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (2024.5.15)\nRequirement already satisfied: tabulate>=0.8.9 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.9.0)\nRequirement already satisfied: numpy>=1.17 in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (1.26.4)\nRequirement already satisfied: colorama in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (0.4.6)\nRequirement already satisfied: lxml in /opt/conda/lib/python3.10/site-packages (from sacrebleu) (5.3.0)\nDownloading sacrebleu-2.4.3-py3-none-any.whl (103 kB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m104.0/104.0 kB\u001b[0m \u001b[31m4.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n\u001b[?25hDownloading portalocker-2.10.1-py3-none-any.whl (18 kB)\nInstalling collected packages: portalocker, sacrebleu\nSuccessfully installed portalocker-2.10.1 sacrebleu-2.4.3\n","output_type":"stream"}]},{"cell_type":"code","source":"!pip install wandb -qqq\nimport wandb\nwandb.login()","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:00:47.095135Z","iopub.execute_input":"2024-10-13T04:00:47.095477Z","iopub.status.idle":"2024-10-13T04:01:19.743885Z","shell.execute_reply.started":"2024-10-13T04:00:47.095441Z","shell.execute_reply":"2024-10-13T04:01:19.742777Z"},"trusted":true},"execution_count":3,"outputs":[{"name":"stderr","text":"\u001b[34m\u001b[1mwandb\u001b[0m: Using wandb-core as the SDK backend. Please refer to https://wandb.me/wandb-core for more information.\n\u001b[34m\u001b[1mwandb\u001b[0m: Logging into wandb.ai. (Learn how to deploy a W&B server locally: https://wandb.me/wandb-server)\n\u001b[34m\u001b[1mwandb\u001b[0m: You can find your API key in your browser here: https://wandb.ai/authorize\n\u001b[34m\u001b[1mwandb\u001b[0m: Paste an API key from your profile and hit enter, or press ctrl+c to quit:","output_type":"stream"},{"output_type":"stream","name":"stdin","text":" ········································\n"},{"name":"stderr","text":"\u001b[34m\u001b[1mwandb\u001b[0m: Appending key for api.wandb.ai to your netrc file: /root/.netrc\n","output_type":"stream"},{"execution_count":3,"output_type":"execute_result","data":{"text/plain":"True"},"metadata":{}}]},{"cell_type":"code","source":"# Initialize wandb.run first\nwandb.init()\n\n# If cell outputs wandb.run, you'll see live graphs\nwandb.run","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:01:19.746153Z","iopub.execute_input":"2024-10-13T04:01:19.746742Z","iopub.status.idle":"2024-10-13T04:01:23.136029Z","shell.execute_reply.started":"2024-10-13T04:01:19.746702Z","shell.execute_reply":"2024-10-13T04:01:23.135072Z"},"trusted":true},"execution_count":4,"outputs":[{"name":"stderr","text":"\u001b[34m\u001b[1mwandb\u001b[0m: Currently logged in as: \u001b[33msarch7040\u001b[0m (\u001b[33msarch7040-\u001b[0m). Use \u001b[1m`wandb login --relogin`\u001b[0m to force relogin\n","output_type":"stream"},{"output_type":"display_data","data":{"text/plain":"VBox(children=(Label(value='Waiting for wandb.init()...\\r'), FloatProgress(value=0.011112782366666983, max=1.0…","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"3c66afed2b82401bbe5179218d4ef737"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"<IPython.core.display.HTML object>","text/html":"Tracking run with wandb version 0.18.3"},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"<IPython.core.display.HTML object>","text/html":"Run data is saved locally in <code>/kaggle/working/wandb/run-20241013_040119-uj3tsimu</code>"},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"<IPython.core.display.HTML object>","text/html":"Syncing run <strong><a href='https://wandb.ai/sarch7040-/uncategorized/runs/uj3tsimu' target=\"_blank\">grateful-snow-4</a></strong> to <a href='https://wandb.ai/sarch7040-/uncategorized' target=\"_blank\">Weights & Biases</a> (<a href='https://wandb.me/run' target=\"_blank\">docs</a>)<br/>"},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"<IPython.core.display.HTML object>","text/html":" View project at <a href='https://wandb.ai/sarch7040-/uncategorized' target=\"_blank\">https://wandb.ai/sarch7040-/uncategorized</a>"},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"<IPython.core.display.HTML object>","text/html":" View run at <a href='https://wandb.ai/sarch7040-/uncategorized/runs/uj3tsimu' target=\"_blank\">https://wandb.ai/sarch7040-/uncategorized/runs/uj3tsimu</a>"},"metadata":{}},{"execution_count":4,"output_type":"execute_result","data":{"text/html":"<button onClick=\"this.nextSibling.style.display='block';this.style.display='none';\">Display W&B run</button><iframe src='https://wandb.ai/sarch7040-/uncategorized/runs/uj3tsimu?jupyter=true' style='border:none;width:100%;height:420px;display:none;'></iframe>","text/plain":"<wandb.sdk.wandb_run.Run at 0x7d48c92cd0c0>"},"metadata":{}}]},{"cell_type":"code","source":"from transformers import AutoTokenizer, M2M100ForConditionalGeneration,Seq2SeqTrainingArguments, Seq2SeqTrainer, DataCollatorForSeq2Seq,pipeline\nfrom huggingface_hub import notebook_login\nfrom datasets import load_dataset\nimport evaluate\nimport numpy as np","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:01:23.137721Z","iopub.execute_input":"2024-10-13T04:01:23.138493Z","iopub.status.idle":"2024-10-13T04:01:43.683149Z","shell.execute_reply.started":"2024-10-13T04:01:23.138456Z","shell.execute_reply":"2024-10-13T04:01:43.682181Z"},"trusted":true},"execution_count":5,"outputs":[]},{"cell_type":"code","source":"model = M2M100ForConditionalGeneration.from_pretrained(\"facebook/m2m100_418M\")\ntokenizer = AutoTokenizer.from_pretrained(\"facebook/m2m100_418M\")","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:01:43.684472Z","iopub.execute_input":"2024-10-13T04:01:43.685094Z","iopub.status.idle":"2024-10-13T04:01:55.228054Z","shell.execute_reply.started":"2024-10-13T04:01:43.685058Z","shell.execute_reply":"2024-10-13T04:01:55.227221Z"},"trusted":true},"execution_count":6,"outputs":[{"output_type":"display_data","data":{"text/plain":"config.json: 0%| | 0.00/908 [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"36f8129324bf4c3daf16a886e2e0118e"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"pytorch_model.bin: 0%| | 0.00/1.94G [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"6096c80a15404ae5bc4ad9b5a993a73e"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"generation_config.json: 0%| | 0.00/233 [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"1933610ef18145efb94d7f8a43d7a367"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"tokenizer_config.json: 0%| | 0.00/298 [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"dea7f7584c794371ad5ddb8e746286e1"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"vocab.json: 0%| | 0.00/3.71M [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"61d8b86b22664b2e95628c17914c15d4"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"sentencepiece.bpe.model: 0%| | 0.00/2.42M [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"dc57afa9ee304cb89b17bddc7c22ae6a"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"special_tokens_map.json: 0%| | 0.00/1.14k [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"f712c792c5fb486dbb3dc38759837e2f"}},"metadata":{}},{"name":"stderr","text":"/opt/conda/lib/python3.10/site-packages/transformers/tokenization_utils_base.py:1617: FutureWarning: `clean_up_tokenization_spaces` was not set. It will be set to `True` by default. This behavior will be deprecated in transformers v4.45, and will be then set to `False` by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884\n warnings.warn(\n","output_type":"stream"}]},{"cell_type":"code","source":"!pip install huggingface_hub\n\nfrom huggingface_hub import login\n\n# Prompt for your Hugging Face token\ntoken = \"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\"\n\n# Log in to Hugging Face\nlogin(token)\n","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:02:29.639557Z","iopub.execute_input":"2024-10-13T04:02:29.639955Z","iopub.status.idle":"2024-10-13T04:02:41.765380Z","shell.execute_reply.started":"2024-10-13T04:02:29.639917Z","shell.execute_reply":"2024-10-13T04:02:41.764308Z"},"trusted":true},"execution_count":8,"outputs":[{"name":"stdout","text":"Requirement already satisfied: huggingface_hub in /opt/conda/lib/python3.10/site-packages (0.25.1)\nRequirement already satisfied: filelock in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (3.15.1)\nRequirement already satisfied: fsspec>=2023.5.0 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (2024.6.1)\nRequirement already satisfied: packaging>=20.9 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (21.3)\nRequirement already satisfied: pyyaml>=5.1 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (6.0.2)\nRequirement already satisfied: requests in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (2.32.3)\nRequirement already satisfied: tqdm>=4.42.1 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (4.66.4)\nRequirement already satisfied: typing-extensions>=3.7.4.3 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (4.12.2)\nRequirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /opt/conda/lib/python3.10/site-packages (from packaging>=20.9->huggingface_hub) (3.1.2)\nRequirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (3.3.2)\nRequirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (3.7)\nRequirement already satisfied: urllib3<3,>=1.21.1 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (1.26.18)\nRequirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (2024.8.30)\nThe token has not been saved to the git credentials helper. Pass `add_to_git_credential=True` in this function directly or `--add-to-git-credential` if using via `huggingface-cli` if you want to set the git credential as well.\nToken is valid (permission: fineGrained).\nYour token has been saved to /root/.cache/huggingface/token\nLogin successful\n","output_type":"stream"}]},{"cell_type":"code","source":"from datasets import load_dataset\nimport unicodedata\nfrom transformers import AutoTokenizer, AutoModelForSeq2SeqLM\n\n# Load dataset\ndataset = load_dataset(\"csv\", data_files=\"/kaggle/input/praendataset/prakrit_translation.csv\")\n\n# Preprocessing function\ndef preprocess_function(examples):\n # Helper function to remove punctuation using Unicode categories\n def remove_punctuation(text):\n return ''.join(\n char for char in text\n if not unicodedata.category(char).startswith('P')\n )\n \n # Remove punctuation from English and Prakrit sentences\n examples['english'] = [remove_punctuation(sentence) for sentence in examples['english']]\n examples['prakrit'] = [remove_punctuation(sentence) for sentence in examples['prakrit']]\n \n return examples\n\n# Apply preprocessing\ndataset = dataset.map(preprocess_function, batched=True)\n\n\n# Tokenization function\nmax_length = 128\ndef tokenization(examples):\n inputs = examples[\"prakrit\"]\n targets = examples[\"english\"]\n \n # Tokenize inputs and targets\n model_inputs = tokenizer(inputs, max_length=max_length, truncation=True, padding=\"max_length\")\n labels = tokenizer(targets, max_length=max_length, truncation=True, padding=\"max_length\")\n \n # Set labels in the tokenized inputs\n model_inputs[\"labels\"] = labels[\"input_ids\"]\n \n return model_inputs\n\n# Apply tokenization to the dataset\ntokenized_dataset = dataset.map(tokenization, batched=True)\n\n# Display some tokenized data\n","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:02:41.767501Z","iopub.execute_input":"2024-10-13T04:02:41.767865Z","iopub.status.idle":"2024-10-13T04:02:45.646354Z","shell.execute_reply.started":"2024-10-13T04:02:41.767825Z","shell.execute_reply":"2024-10-13T04:02:45.645429Z"},"trusted":true},"execution_count":9,"outputs":[{"output_type":"display_data","data":{"text/plain":"Generating train split: 0 examples [00:00, ? examples/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"a9dc86182afd45f7a3c2009cddaea0ca"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"Map: 0%| | 0/1474 [00:00<?, ? examples/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"ad976916753f4d8a88b85b70ecdee2f6"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"Map: 0%| | 0/1474 [00:00<?, ? examples/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"3df6b5cb800d4af09bdce7ce7673c939"}},"metadata":{}}]},{"cell_type":"code","source":"tokenized_dataset","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:02:45.648411Z","iopub.execute_input":"2024-10-13T04:02:45.649091Z","iopub.status.idle":"2024-10-13T04:02:45.656029Z","shell.execute_reply.started":"2024-10-13T04:02:45.649033Z","shell.execute_reply":"2024-10-13T04:02:45.655083Z"},"trusted":true},"execution_count":10,"outputs":[{"execution_count":10,"output_type":"execute_result","data":{"text/plain":"DatasetDict({\n train: Dataset({\n features: ['english', 'prakrit', 'input_ids', 'attention_mask', 'labels'],\n num_rows: 1474\n })\n})"},"metadata":{}}]},{"cell_type":"code","source":"!pip install --upgrade evaluate\n","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:02:45.657315Z","iopub.execute_input":"2024-10-13T04:02:45.657702Z","iopub.status.idle":"2024-10-13T04:02:58.549969Z","shell.execute_reply.started":"2024-10-13T04:02:45.657657Z","shell.execute_reply":"2024-10-13T04:02:58.548823Z"},"trusted":true},"execution_count":11,"outputs":[{"name":"stderr","text":"/opt/conda/lib/python3.10/pty.py:89: RuntimeWarning: os.fork() was called. os.fork() is incompatible with multithreaded code, and JAX is multithreaded, so this will likely lead to a deadlock.\n pid, fd = os.forkpty()\n","output_type":"stream"},{"name":"stdout","text":"Requirement already satisfied: evaluate in /opt/conda/lib/python3.10/site-packages (0.4.3)\nRequirement already satisfied: datasets>=2.0.0 in /opt/conda/lib/python3.10/site-packages (from evaluate) (3.0.1)\nRequirement already satisfied: numpy>=1.17 in /opt/conda/lib/python3.10/site-packages (from evaluate) (1.26.4)\nRequirement already satisfied: dill in /opt/conda/lib/python3.10/site-packages (from evaluate) (0.3.8)\nRequirement already satisfied: pandas in /opt/conda/lib/python3.10/site-packages (from evaluate) (2.2.2)\nRequirement already satisfied: requests>=2.19.0 in /opt/conda/lib/python3.10/site-packages (from evaluate) (2.32.3)\nRequirement already satisfied: tqdm>=4.62.1 in /opt/conda/lib/python3.10/site-packages (from evaluate) (4.66.4)\nRequirement already satisfied: xxhash in /opt/conda/lib/python3.10/site-packages (from evaluate) (3.4.1)\nRequirement already satisfied: multiprocess in /opt/conda/lib/python3.10/site-packages (from evaluate) (0.70.16)\nRequirement already satisfied: fsspec>=2021.05.0 in /opt/conda/lib/python3.10/site-packages (from fsspec[http]>=2021.05.0->evaluate) (2024.6.1)\nRequirement already satisfied: huggingface-hub>=0.7.0 in /opt/conda/lib/python3.10/site-packages (from evaluate) (0.25.1)\nRequirement already satisfied: packaging in /opt/conda/lib/python3.10/site-packages (from evaluate) (21.3)\nRequirement already satisfied: filelock in /opt/conda/lib/python3.10/site-packages (from datasets>=2.0.0->evaluate) (3.15.1)\nRequirement already satisfied: pyarrow>=15.0.0 in /opt/conda/lib/python3.10/site-packages (from datasets>=2.0.0->evaluate) (16.1.0)\nRequirement already satisfied: aiohttp in /opt/conda/lib/python3.10/site-packages (from datasets>=2.0.0->evaluate) (3.9.5)\nRequirement already satisfied: pyyaml>=5.1 in /opt/conda/lib/python3.10/site-packages (from datasets>=2.0.0->evaluate) (6.0.2)\nRequirement already satisfied: typing-extensions>=3.7.4.3 in /opt/conda/lib/python3.10/site-packages (from huggingface-hub>=0.7.0->evaluate) (4.12.2)\nRequirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /opt/conda/lib/python3.10/site-packages (from packaging->evaluate) (3.1.2)\nRequirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.10/site-packages (from requests>=2.19.0->evaluate) (3.3.2)\nRequirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.10/site-packages (from requests>=2.19.0->evaluate) (3.7)\nRequirement already satisfied: urllib3<3,>=1.21.1 in /opt/conda/lib/python3.10/site-packages (from requests>=2.19.0->evaluate) (1.26.18)\nRequirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.10/site-packages (from requests>=2.19.0->evaluate) (2024.8.30)\nRequirement already satisfied: python-dateutil>=2.8.2 in /opt/conda/lib/python3.10/site-packages (from pandas->evaluate) (2.9.0.post0)\nRequirement already satisfied: pytz>=2020.1 in /opt/conda/lib/python3.10/site-packages (from pandas->evaluate) (2024.1)\nRequirement already satisfied: tzdata>=2022.7 in /opt/conda/lib/python3.10/site-packages (from pandas->evaluate) (2024.1)\nRequirement already satisfied: aiosignal>=1.1.2 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets>=2.0.0->evaluate) (1.3.1)\nRequirement already satisfied: attrs>=17.3.0 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets>=2.0.0->evaluate) (23.2.0)\nRequirement already satisfied: frozenlist>=1.1.1 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets>=2.0.0->evaluate) (1.4.1)\nRequirement already satisfied: multidict<7.0,>=4.5 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets>=2.0.0->evaluate) (6.0.5)\nRequirement already satisfied: yarl<2.0,>=1.0 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets>=2.0.0->evaluate) (1.9.4)\nRequirement already satisfied: async-timeout<5.0,>=4.0 in /opt/conda/lib/python3.10/site-packages (from aiohttp->datasets>=2.0.0->evaluate) (4.0.3)\nRequirement already satisfied: six>=1.5 in /opt/conda/lib/python3.10/site-packages (from python-dateutil>=2.8.2->pandas->evaluate) (1.16.0)\n","output_type":"stream"}]},{"cell_type":"code","source":"from transformers import AutoTokenizer, M2M100ForConditionalGeneration,Seq2SeqTrainingArguments, Seq2SeqTrainer, DataCollatorForSeq2Seq,pipeline\nfrom huggingface_hub import notebook_login\nfrom datasets import load_dataset\nimport evaluate\nimport numpy as np","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:02:58.552639Z","iopub.execute_input":"2024-10-13T04:02:58.552992Z","iopub.status.idle":"2024-10-13T04:02:58.559634Z","shell.execute_reply.started":"2024-10-13T04:02:58.552953Z","shell.execute_reply":"2024-10-13T04:02:58.558454Z"},"trusted":true},"execution_count":12,"outputs":[]},{"cell_type":"code","source":"model = M2M100ForConditionalGeneration.from_pretrained(\"facebook/m2m100_418M\")\ntokenizer = AutoTokenizer.from_pretrained(\"facebook/m2m100_418M\")","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:02:58.560923Z","iopub.execute_input":"2024-10-13T04:02:58.561376Z","iopub.status.idle":"2024-10-13T04:02:59.695353Z","shell.execute_reply.started":"2024-10-13T04:02:58.561325Z","shell.execute_reply":"2024-10-13T04:02:59.694505Z"},"trusted":true},"execution_count":13,"outputs":[{"name":"stderr","text":"/opt/conda/lib/python3.10/site-packages/transformers/tokenization_utils_base.py:1617: FutureWarning: `clean_up_tokenization_spaces` was not set. It will be set to `True` by default. This behavior will be deprecated in transformers v4.45, and will be then set to `False` by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884\n warnings.warn(\n","output_type":"stream"}]},{"cell_type":"code","source":"from transformers import DataCollatorForSeq2Seq\n\ndata_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=model)","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:02:59.696748Z","iopub.execute_input":"2024-10-13T04:02:59.697199Z","iopub.status.idle":"2024-10-13T04:02:59.703602Z","shell.execute_reply.started":"2024-10-13T04:02:59.697150Z","shell.execute_reply":"2024-10-13T04:02:59.702530Z"},"trusted":true},"execution_count":14,"outputs":[]},{"cell_type":"code","source":"# Perform train-test split with 20% of the data as the test set\ntokenized_dataset = tokenized_dataset[\"train\"].train_test_split(test_size=0.2)\n\n# Check the split\ntokenized_dataset\n","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:02:59.704774Z","iopub.execute_input":"2024-10-13T04:02:59.705095Z","iopub.status.idle":"2024-10-13T04:02:59.730080Z","shell.execute_reply.started":"2024-10-13T04:02:59.705062Z","shell.execute_reply":"2024-10-13T04:02:59.729251Z"},"trusted":true},"execution_count":15,"outputs":[{"execution_count":15,"output_type":"execute_result","data":{"text/plain":"DatasetDict({\n train: Dataset({\n features: ['english', 'prakrit', 'input_ids', 'attention_mask', 'labels'],\n num_rows: 1179\n })\n test: Dataset({\n features: ['english', 'prakrit', 'input_ids', 'attention_mask', 'labels'],\n num_rows: 295\n })\n})"},"metadata":{}}]},{"cell_type":"code","source":"!pip install --upgrade nltk\n","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:02:59.731136Z","iopub.execute_input":"2024-10-13T04:02:59.731423Z","iopub.status.idle":"2024-10-13T04:03:14.021271Z","shell.execute_reply.started":"2024-10-13T04:02:59.731392Z","shell.execute_reply":"2024-10-13T04:03:14.020343Z"},"trusted":true},"execution_count":16,"outputs":[{"name":"stdout","text":"Requirement already satisfied: nltk in /opt/conda/lib/python3.10/site-packages (3.2.4)\nCollecting nltk\n Downloading nltk-3.9.1-py3-none-any.whl.metadata (2.9 kB)\nRequirement already satisfied: click in /opt/conda/lib/python3.10/site-packages (from nltk) (8.1.7)\nRequirement already satisfied: joblib in /opt/conda/lib/python3.10/site-packages (from nltk) (1.4.2)\nRequirement already satisfied: regex>=2021.8.3 in /opt/conda/lib/python3.10/site-packages (from nltk) (2024.5.15)\nRequirement already satisfied: tqdm in /opt/conda/lib/python3.10/site-packages (from nltk) (4.66.4)\nDownloading nltk-3.9.1-py3-none-any.whl (1.5 MB)\n\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.5/1.5 MB\u001b[0m \u001b[31m16.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m0:01\u001b[0m\n\u001b[?25hInstalling collected packages: nltk\n Attempting uninstall: nltk\n Found existing installation: nltk 3.2.4\n Uninstalling nltk-3.2.4:\n Successfully uninstalled nltk-3.2.4\n\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\npreprocessing 0.1.13 requires nltk==3.2.4, but you have nltk 3.9.1 which is incompatible.\u001b[0m\u001b[31m\n\u001b[0mSuccessfully installed nltk-3.9.1\n","output_type":"stream"}]},{"cell_type":"code","source":"import nltk\nimport evaluate\n\n# Download required NLTK datasets\nnltk.download('wordnet')\nnltk.download('omw-1.4')\n\n# Load metrics\nbleu_metric = evaluate.load(\"sacrebleu\")\nmeteor_metric = evaluate.load(\"meteor\")","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:03:14.022706Z","iopub.execute_input":"2024-10-13T04:03:14.023036Z","iopub.status.idle":"2024-10-13T04:03:16.255060Z","shell.execute_reply.started":"2024-10-13T04:03:14.022994Z","shell.execute_reply":"2024-10-13T04:03:16.254163Z"},"trusted":true},"execution_count":17,"outputs":[{"name":"stderr","text":"[nltk_data] Downloading package wordnet to /usr/share/nltk_data...\n[nltk_data] Package wordnet is already up-to-date!\n[nltk_data] Downloading package omw-1.4 to /usr/share/nltk_data...\n","output_type":"stream"},{"output_type":"display_data","data":{"text/plain":"Downloading builder script: 0%| | 0.00/8.15k [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"96c43d90a14d4f8b9c1566be3b7c67bd"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"Downloading builder script: 0%| | 0.00/7.02k [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"cb64ff1907ba40c19d26f187e36135b8"}},"metadata":{}},{"name":"stderr","text":"[nltk_data] Downloading package wordnet to /usr/share/nltk_data...\n[nltk_data] Package wordnet is already up-to-date!\n[nltk_data] Downloading package punkt_tab to /usr/share/nltk_data...\n[nltk_data] Unzipping tokenizers/punkt_tab.zip.\n[nltk_data] Downloading package omw-1.4 to /usr/share/nltk_data...\n[nltk_data] Package omw-1.4 is already up-to-date!\n","output_type":"stream"}]},{"cell_type":"code","source":"def postprocess_text(preds, labels):\n preds = [pred.strip() for pred in preds]\n labels = [[label.strip()] for label in labels]\n\n return preds, labels\n\n\ndef compute_metrics(eval_preds):\n preds, labels = eval_preds\n if isinstance(preds, tuple):\n preds = preds[0]\n decoded_preds = tokenizer.batch_decode(preds, skip_special_tokens=True)\n\n labels = np.where(labels != -100, labels, tokenizer.pad_token_id)\n decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)\n\n # Postprocess the text (strip extra spaces)\n decoded_preds, decoded_labels = postprocess_text(decoded_preds, decoded_labels)\n\n # Compute BLEU score\n bleu_result = bleu_metric.compute(predictions=decoded_preds, references=decoded_labels)\n\n # Compute METEOR score\n meteor_result = meteor_metric.compute(predictions=decoded_preds, references=decoded_labels)\n\n # Compute generation lengths\n prediction_lens = [np.count_nonzero(pred != tokenizer.pad_token_id) for pred in preds]\n\n # Combine the results\n result = {'bleu': bleu_result['score'], 'meteor': meteor_result['meteor']}\n result[\"gen_len\"] = np.mean(prediction_lens)\n\n # Round results to 4 decimal places\n result = {k: round(v, 4) for k, v in result.items()}\n \n return result\n","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:03:16.258223Z","iopub.execute_input":"2024-10-13T04:03:16.258893Z","iopub.status.idle":"2024-10-13T04:03:16.271170Z","shell.execute_reply.started":"2024-10-13T04:03:16.258856Z","shell.execute_reply":"2024-10-13T04:03:16.269904Z"},"trusted":true},"execution_count":18,"outputs":[]},{"cell_type":"code","source":"from transformers import AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:03:16.272826Z","iopub.execute_input":"2024-10-13T04:03:16.273442Z","iopub.status.idle":"2024-10-13T04:03:16.285551Z","shell.execute_reply.started":"2024-10-13T04:03:16.273387Z","shell.execute_reply":"2024-10-13T04:03:16.284474Z"},"trusted":true},"execution_count":19,"outputs":[]},{"cell_type":"code","source":"training_args = Seq2SeqTrainingArguments(\n output_dir=\"M2M101\",\n evaluation_strategy=\"epoch\",\n learning_rate=1e-5,\n per_device_train_batch_size=8,\n per_device_eval_batch_size=8,\n weight_decay=0.01,\n save_total_limit=3,\n num_train_epochs=20,\n predict_with_generate=True,\n fp16=True,\n push_to_hub=True,\n)\n\ntrainer = Seq2SeqTrainer(\n model=model,\n args=training_args,\n train_dataset=tokenized_dataset[\"train\"],\n eval_dataset=tokenized_dataset[\"test\"],\n tokenizer=tokenizer,\n data_collator=data_collator,\n compute_metrics=compute_metrics,\n)\n\n# for starting the training of model\ntrainer.train()","metadata":{"execution":{"iopub.status.busy":"2024-10-13T04:03:16.286865Z","iopub.execute_input":"2024-10-13T04:03:16.287267Z","iopub.status.idle":"2024-10-13T05:36:34.581097Z","shell.execute_reply.started":"2024-10-13T04:03:16.287223Z","shell.execute_reply":"2024-10-13T05:36:34.580024Z"},"trusted":true},"execution_count":20,"outputs":[{"name":"stderr","text":"/opt/conda/lib/python3.10/site-packages/transformers/training_args.py:1545: FutureWarning: `evaluation_strategy` is deprecated and will be removed in version 4.46 of 🤗 Transformers. Use `eval_strategy` instead\n warnings.warn(\n/opt/conda/lib/python3.10/site-packages/accelerate/accelerator.py:494: FutureWarning: `torch.cuda.amp.GradScaler(args...)` is deprecated. Please use `torch.amp.GradScaler('cuda', args...)` instead.\n self.scaler = torch.cuda.amp.GradScaler(**kwargs)\n\u001b[34m\u001b[1mwandb\u001b[0m: \u001b[33mWARNING\u001b[0m The `run_name` is currently set to the same value as `TrainingArguments.output_dir`. If this was not intended, please specify a different run name by setting the `TrainingArguments.run_name` parameter.\n/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/parallel_apply.py:79: FutureWarning: `torch.cuda.amp.autocast(args...)` is deprecated. Please use `torch.amp.autocast('cuda', args...)` instead.\n with torch.cuda.device(device), torch.cuda.stream(stream), autocast(enabled=autocast_enabled):\n/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.\n warnings.warn('Was asked to gather along dimension 0, but all '\n","output_type":"stream"},{"output_type":"display_data","data":{"text/plain":"<IPython.core.display.HTML object>","text/html":"\n <div>\n \n <progress value='1480' max='1480' style='width:300px; height:20px; vertical-align: middle;'></progress>\n [1480/1480 1:33:13, Epoch 20/20]\n </div>\n <table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: left;\">\n <th>Epoch</th>\n <th>Training Loss</th>\n <th>Validation Loss</th>\n <th>Bleu</th>\n <th>Meteor</th>\n <th>Gen Len</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>1</td>\n <td>No log</td>\n <td>5.826086</td>\n <td>1.178600</td>\n <td>0.199700</td>\n <td>36.383100</td>\n </tr>\n <tr>\n <td>2</td>\n <td>No log</td>\n <td>4.616993</td>\n <td>2.648000</td>\n <td>0.265700</td>\n <td>37.606800</td>\n </tr>\n <tr>\n <td>3</td>\n <td>No log</td>\n <td>3.512793</td>\n <td>5.706900</td>\n <td>0.321700</td>\n <td>32.216900</td>\n </tr>\n <tr>\n <td>4</td>\n <td>No log</td>\n <td>2.528102</td>\n <td>6.313400</td>\n <td>0.354700</td>\n <td>31.857600</td>\n </tr>\n <tr>\n <td>5</td>\n <td>No log</td>\n <td>1.717724</td>\n <td>8.503600</td>\n <td>0.380000</td>\n <td>29.972900</td>\n </tr>\n <tr>\n <td>6</td>\n <td>No log</td>\n <td>1.166630</td>\n <td>10.116900</td>\n <td>0.392500</td>\n <td>28.067800</td>\n </tr>\n <tr>\n <td>7</td>\n <td>3.564100</td>\n <td>0.870194</td>\n <td>10.420700</td>\n <td>0.424600</td>\n <td>31.105100</td>\n </tr>\n <tr>\n <td>8</td>\n <td>3.564100</td>\n <td>0.737626</td>\n <td>12.615300</td>\n <td>0.431000</td>\n <td>28.633900</td>\n </tr>\n <tr>\n <td>9</td>\n <td>3.564100</td>\n <td>0.690092</td>\n <td>13.296600</td>\n <td>0.450300</td>\n <td>29.237300</td>\n </tr>\n <tr>\n <td>10</td>\n <td>3.564100</td>\n <td>0.671265</td>\n <td>11.977200</td>\n <td>0.439600</td>\n <td>30.566100</td>\n </tr>\n <tr>\n <td>11</td>\n <td>3.564100</td>\n <td>0.665060</td>\n <td>14.043600</td>\n <td>0.450600</td>\n <td>30.200000</td>\n </tr>\n <tr>\n <td>12</td>\n <td>3.564100</td>\n <td>0.667843</td>\n <td>13.263200</td>\n <td>0.451400</td>\n <td>31.054200</td>\n </tr>\n <tr>\n <td>13</td>\n <td>3.564100</td>\n <td>0.667750</td>\n <td>14.092400</td>\n <td>0.456300</td>\n <td>29.278000</td>\n </tr>\n <tr>\n <td>14</td>\n <td>0.512100</td>\n <td>0.669289</td>\n <td>14.746000</td>\n <td>0.465100</td>\n <td>28.406800</td>\n </tr>\n <tr>\n <td>15</td>\n <td>0.512100</td>\n <td>0.669845</td>\n <td>14.927800</td>\n <td>0.467700</td>\n <td>28.515300</td>\n </tr>\n <tr>\n <td>16</td>\n <td>0.512100</td>\n <td>0.670038</td>\n <td>14.743100</td>\n <td>0.467400</td>\n <td>28.928800</td>\n </tr>\n <tr>\n <td>17</td>\n <td>0.512100</td>\n <td>0.674381</td>\n <td>15.293400</td>\n <td>0.470100</td>\n <td>28.867800</td>\n </tr>\n <tr>\n <td>18</td>\n <td>0.512100</td>\n <td>0.674102</td>\n <td>15.677600</td>\n <td>0.471200</td>\n <td>28.349200</td>\n </tr>\n <tr>\n <td>19</td>\n <td>0.512100</td>\n <td>0.677232</td>\n <td>14.942000</td>\n <td>0.470700</td>\n <td>28.969500</td>\n </tr>\n <tr>\n <td>20</td>\n <td>0.512100</td>\n <td>0.676572</td>\n <td>15.341600</td>\n <td>0.472300</td>\n <td>28.027100</td>\n </tr>\n </tbody>\n</table><p>"},"metadata":{}},{"name":"stderr","text":"/opt/conda/lib/python3.10/site-packages/transformers/modeling_utils.py:2618: UserWarning: Moving the following attributes in the config to the generation config: {'max_length': 200, 'early_stopping': True, 'num_beams': 5}. You are seeing this warning because you've set generation parameters in the model config, as opposed to in the generation config.\n warnings.warn(\n/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/parallel_apply.py:79: FutureWarning: `torch.cuda.amp.autocast(args...)` is deprecated. Please use `torch.amp.autocast('cuda', args...)` instead.\n with torch.cuda.device(device), torch.cuda.stream(stream), autocast(enabled=autocast_enabled):\n/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.\n warnings.warn('Was asked to gather along dimension 0, but all '\n/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/parallel_apply.py:79: FutureWarning: `torch.cuda.amp.autocast(args...)` is deprecated. Please use `torch.amp.autocast('cuda', args...)` instead.\n with torch.cuda.device(device), torch.cuda.stream(stream), autocast(enabled=autocast_enabled):\n/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.\n warnings.warn('Was asked to gather along dimension 0, but all '\n/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/parallel_apply.py:79: FutureWarning: `torch.cuda.amp.autocast(args...)` is deprecated. Please use `torch.amp.autocast('cuda', args...)` instead.\n with torch.cuda.device(device), torch.cuda.stream(stream), autocast(enabled=autocast_enabled):\n/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/_functions.py:68: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.\n warnings.warn('Was asked to gather along dimension 0, but all '\n","output_type":"stream"},{"execution_count":20,"output_type":"execute_result","data":{"text/plain":"TrainOutput(global_step=1480, training_loss=1.4915999850711308, metrics={'train_runtime': 5596.282, 'train_samples_per_second': 4.214, 'train_steps_per_second': 0.264, 'total_flos': 6387540814725120.0, 'train_loss': 1.4915999850711308, 'epoch': 20.0})"},"metadata":{}}]},{"cell_type":"code","source":"trainer.push_to_hub()","metadata":{"execution":{"iopub.status.busy":"2024-10-13T05:36:34.582611Z","iopub.execute_input":"2024-10-13T05:36:34.583362Z","iopub.status.idle":"2024-10-13T05:36:53.872348Z","shell.execute_reply.started":"2024-10-13T05:36:34.583312Z","shell.execute_reply":"2024-10-13T05:36:53.871321Z"},"trusted":true},"execution_count":21,"outputs":[{"output_type":"display_data","data":{"text/plain":"events.out.tfevents.1728792198.7afee8f5ccfd.30.0: 0%| | 0.00/14.5k [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"036f7878ca094bb283ce097c4e0c5626"}},"metadata":{}},{"execution_count":21,"output_type":"execute_result","data":{"text/plain":"CommitInfo(commit_url='https://huggingface.co/sarch7040/M2M101/commit/9b4bf86769b33fe25a0f041812424d698f3d1680', commit_message='End of training', commit_description='', oid='9b4bf86769b33fe25a0f041812424d698f3d1680', pr_url=None, repo_url=RepoUrl('https://huggingface.co/sarch7040/M2M101', endpoint='https://huggingface.co', repo_type='model', repo_id='sarch7040/M2M101'), pr_revision=None, pr_num=None)"},"metadata":{}}]},{"cell_type":"code","source":"# Use a pipeline as a high-level helper\nfrom transformers import pipeline\n\npipe = pipeline(\"text2text-generation\", model=\"sarch7040/M2M101\")","metadata":{"execution":{"iopub.status.busy":"2024-10-13T05:36:53.873596Z","iopub.execute_input":"2024-10-13T05:36:53.873929Z","iopub.status.idle":"2024-10-13T05:37:12.785489Z","shell.execute_reply.started":"2024-10-13T05:36:53.873893Z","shell.execute_reply":"2024-10-13T05:37:12.784462Z"},"trusted":true},"execution_count":22,"outputs":[{"output_type":"display_data","data":{"text/plain":"config.json: 0%| | 0.00/935 [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"0db09f63a8aa4379a5168133798583d0"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"model.safetensors: 0%| | 0.00/1.94G [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"97f853df430548df9bb18598ba53b8c9"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"generation_config.json: 0%| | 0.00/198 [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"c1dde5aa3ba0493a9608e71f6b2679b2"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"tokenizer_config.json: 0%| | 0.00/19.8k [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"798e252d89044bc8b2ec925b1fbaf665"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"vocab.json: 0%| | 0.00/3.71M [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"020279d8ba894c4eb2b85909a85730b0"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"sentencepiece.bpe.model: 0%| | 0.00/2.42M [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"5939581fa17f4c8b8879292a5e295ffe"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"added_tokens.json: 0%| | 0.00/2.01k [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"1952c6c2a553475c8ec3e36a0fd827f3"}},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"special_tokens_map.json: 0%| | 0.00/1.56k [00:00<?, ?B/s]","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"0f2c6a33f8b64a62a9d46cd9d6d2ebea"}},"metadata":{}},{"name":"stderr","text":"Hardware accelerator e.g. GPU is available in the environment, but no `device` argument is passed to the `Pipeline` object. Model will be on CPU.\n","output_type":"stream"}]},{"cell_type":"code","source":"pipe(\"चाणक्य\")","metadata":{"execution":{"iopub.status.busy":"2024-10-13T05:37:12.787004Z","iopub.execute_input":"2024-10-13T05:37:12.787889Z","iopub.status.idle":"2024-10-13T05:37:13.833157Z","shell.execute_reply.started":"2024-10-13T05:37:12.787841Z","shell.execute_reply":"2024-10-13T05:37:13.832206Z"},"trusted":true},"execution_count":23,"outputs":[{"execution_count":23,"output_type":"execute_result","data":{"text/plain":"[{'generated_text': 'Charity is'}]"},"metadata":{}}]}]}
__pycache__/translation_model.cpython-312.pyc ADDED
Binary file (942 Bytes). View file
 
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, render_template, request
2
+ from translation_model import translate
3
+ import time
4
+
5
+ app = Flask(__name__)
6
+
7
+ @app.route('/')
8
+ def index():
9
+ return render_template('index.html')
10
+
11
+ @app.route('/translate', methods=['POST'])
12
+ def translate_text():
13
+ start_time = time.time()
14
+ input_text = request.form['prakrit_text']
15
+ translated_text = translate(input_text)
16
+ translation_time = time.time() - start_time
17
+ return render_template('index.html', original_text=input_text, translated_text=translated_text, time_taken=translation_time)
18
+
19
+ if __name__ == '__main__':
20
+ app.run(debug=True)
model/.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
model/README.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: mit
4
+ base_model: facebook/m2m100_418M
5
+ tags:
6
+ - generated_from_trainer
7
+ metrics:
8
+ - bleu
9
+ model-index:
10
+ - name: M2M101
11
+ results: []
12
+ ---
13
+
14
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
15
+ should probably proofread and complete it, then remove this comment. -->
16
+
17
+ # M2M101
18
+
19
+ This model is a fine-tuned version of [facebook/m2m100_418M](https://huggingface.co/facebook/m2m100_418M) on an unknown dataset.
20
+ It achieves the following results on the evaluation set:
21
+ - Loss: 0.6766
22
+ - Bleu: 15.3416
23
+ - Meteor: 0.4723
24
+ - Gen Len: 28.0271
25
+
26
+ ## Model description
27
+
28
+ More information needed
29
+
30
+ ## Intended uses & limitations
31
+
32
+ More information needed
33
+
34
+ ## Training and evaluation data
35
+
36
+ More information needed
37
+
38
+ ## Training procedure
39
+
40
+ ### Training hyperparameters
41
+
42
+ The following hyperparameters were used during training:
43
+ - learning_rate: 1e-05
44
+ - train_batch_size: 16
45
+ - eval_batch_size: 16
46
+ - seed: 42
47
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
48
+ - lr_scheduler_type: linear
49
+ - num_epochs: 20
50
+ - mixed_precision_training: Native AMP
51
+
52
+ ### Training results
53
+
54
+ | Training Loss | Epoch | Step | Validation Loss | Bleu | Meteor | Gen Len |
55
+ |:-------------:|:-----:|:----:|:---------------:|:-------:|:------:|:-------:|
56
+ | No log | 1.0 | 74 | 5.8261 | 1.1786 | 0.1997 | 36.3831 |
57
+ | No log | 2.0 | 148 | 4.6170 | 2.648 | 0.2657 | 37.6068 |
58
+ | No log | 3.0 | 222 | 3.5128 | 5.7069 | 0.3217 | 32.2169 |
59
+ | No log | 4.0 | 296 | 2.5281 | 6.3134 | 0.3547 | 31.8576 |
60
+ | No log | 5.0 | 370 | 1.7177 | 8.5036 | 0.38 | 29.9729 |
61
+ | No log | 6.0 | 444 | 1.1666 | 10.1169 | 0.3925 | 28.0678 |
62
+ | 3.5641 | 7.0 | 518 | 0.8702 | 10.4207 | 0.4246 | 31.1051 |
63
+ | 3.5641 | 8.0 | 592 | 0.7376 | 12.6153 | 0.431 | 28.6339 |
64
+ | 3.5641 | 9.0 | 666 | 0.6901 | 13.2966 | 0.4503 | 29.2373 |
65
+ | 3.5641 | 10.0 | 740 | 0.6713 | 11.9772 | 0.4396 | 30.5661 |
66
+ | 3.5641 | 11.0 | 814 | 0.6651 | 14.0436 | 0.4506 | 30.2 |
67
+ | 3.5641 | 12.0 | 888 | 0.6678 | 13.2632 | 0.4514 | 31.0542 |
68
+ | 3.5641 | 13.0 | 962 | 0.6677 | 14.0924 | 0.4563 | 29.278 |
69
+ | 0.5121 | 14.0 | 1036 | 0.6693 | 14.746 | 0.4651 | 28.4068 |
70
+ | 0.5121 | 15.0 | 1110 | 0.6698 | 14.9278 | 0.4677 | 28.5153 |
71
+ | 0.5121 | 16.0 | 1184 | 0.6700 | 14.7431 | 0.4674 | 28.9288 |
72
+ | 0.5121 | 17.0 | 1258 | 0.6744 | 15.2934 | 0.4701 | 28.8678 |
73
+ | 0.5121 | 18.0 | 1332 | 0.6741 | 15.6776 | 0.4712 | 28.3492 |
74
+ | 0.5121 | 19.0 | 1406 | 0.6772 | 14.942 | 0.4707 | 28.9695 |
75
+ | 0.5121 | 20.0 | 1480 | 0.6766 | 15.3416 | 0.4723 | 28.0271 |
76
+
77
+
78
+ ### Framework versions
79
+
80
+ - Transformers 4.45.1
81
+ - Pytorch 2.4.0
82
+ - Datasets 3.0.1
83
+ - Tokenizers 0.20.0
model/added_tokens.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__af__": 128004,
3
+ "__am__": 128005,
4
+ "__ar__": 128006,
5
+ "__ast__": 128007,
6
+ "__az__": 128008,
7
+ "__ba__": 128009,
8
+ "__be__": 128010,
9
+ "__bg__": 128011,
10
+ "__bn__": 128012,
11
+ "__br__": 128013,
12
+ "__bs__": 128014,
13
+ "__ca__": 128015,
14
+ "__ceb__": 128016,
15
+ "__cs__": 128017,
16
+ "__cy__": 128018,
17
+ "__da__": 128019,
18
+ "__de__": 128020,
19
+ "__el__": 128021,
20
+ "__en__": 128022,
21
+ "__es__": 128023,
22
+ "__et__": 128024,
23
+ "__fa__": 128025,
24
+ "__ff__": 128026,
25
+ "__fi__": 128027,
26
+ "__fr__": 128028,
27
+ "__fy__": 128029,
28
+ "__ga__": 128030,
29
+ "__gd__": 128031,
30
+ "__gl__": 128032,
31
+ "__gu__": 128033,
32
+ "__ha__": 128034,
33
+ "__he__": 128035,
34
+ "__hi__": 128036,
35
+ "__hr__": 128037,
36
+ "__ht__": 128038,
37
+ "__hu__": 128039,
38
+ "__hy__": 128040,
39
+ "__id__": 128041,
40
+ "__ig__": 128042,
41
+ "__ilo__": 128043,
42
+ "__is__": 128044,
43
+ "__it__": 128045,
44
+ "__ja__": 128046,
45
+ "__jv__": 128047,
46
+ "__ka__": 128048,
47
+ "__kk__": 128049,
48
+ "__km__": 128050,
49
+ "__kn__": 128051,
50
+ "__ko__": 128052,
51
+ "__lb__": 128053,
52
+ "__lg__": 128054,
53
+ "__ln__": 128055,
54
+ "__lo__": 128056,
55
+ "__lt__": 128057,
56
+ "__lv__": 128058,
57
+ "__mg__": 128059,
58
+ "__mk__": 128060,
59
+ "__ml__": 128061,
60
+ "__mn__": 128062,
61
+ "__mr__": 128063,
62
+ "__ms__": 128064,
63
+ "__my__": 128065,
64
+ "__ne__": 128066,
65
+ "__nl__": 128067,
66
+ "__no__": 128068,
67
+ "__ns__": 128069,
68
+ "__oc__": 128070,
69
+ "__or__": 128071,
70
+ "__pa__": 128072,
71
+ "__pl__": 128073,
72
+ "__ps__": 128074,
73
+ "__pt__": 128075,
74
+ "__ro__": 128076,
75
+ "__ru__": 128077,
76
+ "__sd__": 128078,
77
+ "__si__": 128079,
78
+ "__sk__": 128080,
79
+ "__sl__": 128081,
80
+ "__so__": 128082,
81
+ "__sq__": 128083,
82
+ "__sr__": 128084,
83
+ "__ss__": 128085,
84
+ "__su__": 128086,
85
+ "__sv__": 128087,
86
+ "__sw__": 128088,
87
+ "__ta__": 128089,
88
+ "__th__": 128090,
89
+ "__tl__": 128091,
90
+ "__tn__": 128092,
91
+ "__tr__": 128093,
92
+ "__uk__": 128094,
93
+ "__ur__": 128095,
94
+ "__uz__": 128096,
95
+ "__vi__": 128097,
96
+ "__wo__": 128098,
97
+ "__xh__": 128099,
98
+ "__yi__": 128100,
99
+ "__yo__": 128101,
100
+ "__zh__": 128102,
101
+ "__zu__": 128103
102
+ }
model/config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "facebook/m2m100_418M",
3
+ "activation_dropout": 0.0,
4
+ "activation_function": "relu",
5
+ "architectures": [
6
+ "M2M100ForConditionalGeneration"
7
+ ],
8
+ "attention_dropout": 0.1,
9
+ "bos_token_id": 0,
10
+ "d_model": 1024,
11
+ "decoder_attention_heads": 16,
12
+ "decoder_ffn_dim": 4096,
13
+ "decoder_layerdrop": 0.05,
14
+ "decoder_layers": 12,
15
+ "decoder_start_token_id": 2,
16
+ "dropout": 0.1,
17
+ "early_stopping": null,
18
+ "encoder_attention_heads": 16,
19
+ "encoder_ffn_dim": 4096,
20
+ "encoder_layerdrop": 0.05,
21
+ "encoder_layers": 12,
22
+ "eos_token_id": 2,
23
+ "gradient_checkpointing": false,
24
+ "init_std": 0.02,
25
+ "is_encoder_decoder": true,
26
+ "max_length": null,
27
+ "max_position_embeddings": 1024,
28
+ "model_type": "m2m_100",
29
+ "num_beams": null,
30
+ "num_hidden_layers": 12,
31
+ "pad_token_id": 1,
32
+ "scale_embedding": true,
33
+ "torch_dtype": "float32",
34
+ "transformers_version": "4.45.1",
35
+ "use_cache": true,
36
+ "vocab_size": 128112
37
+ }
model/generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 0,
3
+ "decoder_start_token_id": 2,
4
+ "early_stopping": true,
5
+ "eos_token_id": 2,
6
+ "max_length": 200,
7
+ "num_beams": 5,
8
+ "pad_token_id": 1,
9
+ "transformers_version": "4.45.1"
10
+ }
model/special_tokens_map.json ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "__af__",
4
+ "__am__",
5
+ "__ar__",
6
+ "__ast__",
7
+ "__az__",
8
+ "__ba__",
9
+ "__be__",
10
+ "__bg__",
11
+ "__bn__",
12
+ "__br__",
13
+ "__bs__",
14
+ "__ca__",
15
+ "__ceb__",
16
+ "__cs__",
17
+ "__cy__",
18
+ "__da__",
19
+ "__de__",
20
+ "__el__",
21
+ "__en__",
22
+ "__es__",
23
+ "__et__",
24
+ "__fa__",
25
+ "__ff__",
26
+ "__fi__",
27
+ "__fr__",
28
+ "__fy__",
29
+ "__ga__",
30
+ "__gd__",
31
+ "__gl__",
32
+ "__gu__",
33
+ "__ha__",
34
+ "__he__",
35
+ "__hi__",
36
+ "__hr__",
37
+ "__ht__",
38
+ "__hu__",
39
+ "__hy__",
40
+ "__id__",
41
+ "__ig__",
42
+ "__ilo__",
43
+ "__is__",
44
+ "__it__",
45
+ "__ja__",
46
+ "__jv__",
47
+ "__ka__",
48
+ "__kk__",
49
+ "__km__",
50
+ "__kn__",
51
+ "__ko__",
52
+ "__lb__",
53
+ "__lg__",
54
+ "__ln__",
55
+ "__lo__",
56
+ "__lt__",
57
+ "__lv__",
58
+ "__mg__",
59
+ "__mk__",
60
+ "__ml__",
61
+ "__mn__",
62
+ "__mr__",
63
+ "__ms__",
64
+ "__my__",
65
+ "__ne__",
66
+ "__nl__",
67
+ "__no__",
68
+ "__ns__",
69
+ "__oc__",
70
+ "__or__",
71
+ "__pa__",
72
+ "__pl__",
73
+ "__ps__",
74
+ "__pt__",
75
+ "__ro__",
76
+ "__ru__",
77
+ "__sd__",
78
+ "__si__",
79
+ "__sk__",
80
+ "__sl__",
81
+ "__so__",
82
+ "__sq__",
83
+ "__sr__",
84
+ "__ss__",
85
+ "__su__",
86
+ "__sv__",
87
+ "__sw__",
88
+ "__ta__",
89
+ "__th__",
90
+ "__tl__",
91
+ "__tn__",
92
+ "__tr__",
93
+ "__uk__",
94
+ "__ur__",
95
+ "__uz__",
96
+ "__vi__",
97
+ "__wo__",
98
+ "__xh__",
99
+ "__yi__",
100
+ "__yo__",
101
+ "__zh__",
102
+ "__zu__"
103
+ ],
104
+ "bos_token": "<s>",
105
+ "eos_token": "</s>",
106
+ "pad_token": "<pad>",
107
+ "sep_token": "</s>",
108
+ "unk_token": "<unk>"
109
+ }
model/tokenizer_config.json ADDED
@@ -0,0 +1,951 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "128004": {
36
+ "content": "__af__",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "128005": {
44
+ "content": "__am__",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "128006": {
52
+ "content": "__ar__",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "128007": {
60
+ "content": "__ast__",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ },
67
+ "128008": {
68
+ "content": "__az__",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": true
74
+ },
75
+ "128009": {
76
+ "content": "__ba__",
77
+ "lstrip": false,
78
+ "normalized": false,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": true
82
+ },
83
+ "128010": {
84
+ "content": "__be__",
85
+ "lstrip": false,
86
+ "normalized": false,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": true
90
+ },
91
+ "128011": {
92
+ "content": "__bg__",
93
+ "lstrip": false,
94
+ "normalized": false,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": true
98
+ },
99
+ "128012": {
100
+ "content": "__bn__",
101
+ "lstrip": false,
102
+ "normalized": false,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": true
106
+ },
107
+ "128013": {
108
+ "content": "__br__",
109
+ "lstrip": false,
110
+ "normalized": false,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": true
114
+ },
115
+ "128014": {
116
+ "content": "__bs__",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": true
122
+ },
123
+ "128015": {
124
+ "content": "__ca__",
125
+ "lstrip": false,
126
+ "normalized": false,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": true
130
+ },
131
+ "128016": {
132
+ "content": "__ceb__",
133
+ "lstrip": false,
134
+ "normalized": false,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": true
138
+ },
139
+ "128017": {
140
+ "content": "__cs__",
141
+ "lstrip": false,
142
+ "normalized": false,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": true
146
+ },
147
+ "128018": {
148
+ "content": "__cy__",
149
+ "lstrip": false,
150
+ "normalized": false,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": true
154
+ },
155
+ "128019": {
156
+ "content": "__da__",
157
+ "lstrip": false,
158
+ "normalized": false,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": true
162
+ },
163
+ "128020": {
164
+ "content": "__de__",
165
+ "lstrip": false,
166
+ "normalized": false,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": true
170
+ },
171
+ "128021": {
172
+ "content": "__el__",
173
+ "lstrip": false,
174
+ "normalized": false,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": true
178
+ },
179
+ "128022": {
180
+ "content": "__en__",
181
+ "lstrip": false,
182
+ "normalized": false,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": true
186
+ },
187
+ "128023": {
188
+ "content": "__es__",
189
+ "lstrip": false,
190
+ "normalized": false,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": true
194
+ },
195
+ "128024": {
196
+ "content": "__et__",
197
+ "lstrip": false,
198
+ "normalized": false,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": true
202
+ },
203
+ "128025": {
204
+ "content": "__fa__",
205
+ "lstrip": false,
206
+ "normalized": false,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": true
210
+ },
211
+ "128026": {
212
+ "content": "__ff__",
213
+ "lstrip": false,
214
+ "normalized": false,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": true
218
+ },
219
+ "128027": {
220
+ "content": "__fi__",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": true
226
+ },
227
+ "128028": {
228
+ "content": "__fr__",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": true
234
+ },
235
+ "128029": {
236
+ "content": "__fy__",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": true
242
+ },
243
+ "128030": {
244
+ "content": "__ga__",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": true
250
+ },
251
+ "128031": {
252
+ "content": "__gd__",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "128032": {
260
+ "content": "__gl__",
261
+ "lstrip": false,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": true
266
+ },
267
+ "128033": {
268
+ "content": "__gu__",
269
+ "lstrip": false,
270
+ "normalized": false,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": true
274
+ },
275
+ "128034": {
276
+ "content": "__ha__",
277
+ "lstrip": false,
278
+ "normalized": false,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": true
282
+ },
283
+ "128035": {
284
+ "content": "__he__",
285
+ "lstrip": false,
286
+ "normalized": false,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": true
290
+ },
291
+ "128036": {
292
+ "content": "__hi__",
293
+ "lstrip": false,
294
+ "normalized": false,
295
+ "rstrip": false,
296
+ "single_word": false,
297
+ "special": true
298
+ },
299
+ "128037": {
300
+ "content": "__hr__",
301
+ "lstrip": false,
302
+ "normalized": false,
303
+ "rstrip": false,
304
+ "single_word": false,
305
+ "special": true
306
+ },
307
+ "128038": {
308
+ "content": "__ht__",
309
+ "lstrip": false,
310
+ "normalized": false,
311
+ "rstrip": false,
312
+ "single_word": false,
313
+ "special": true
314
+ },
315
+ "128039": {
316
+ "content": "__hu__",
317
+ "lstrip": false,
318
+ "normalized": false,
319
+ "rstrip": false,
320
+ "single_word": false,
321
+ "special": true
322
+ },
323
+ "128040": {
324
+ "content": "__hy__",
325
+ "lstrip": false,
326
+ "normalized": false,
327
+ "rstrip": false,
328
+ "single_word": false,
329
+ "special": true
330
+ },
331
+ "128041": {
332
+ "content": "__id__",
333
+ "lstrip": false,
334
+ "normalized": false,
335
+ "rstrip": false,
336
+ "single_word": false,
337
+ "special": true
338
+ },
339
+ "128042": {
340
+ "content": "__ig__",
341
+ "lstrip": false,
342
+ "normalized": false,
343
+ "rstrip": false,
344
+ "single_word": false,
345
+ "special": true
346
+ },
347
+ "128043": {
348
+ "content": "__ilo__",
349
+ "lstrip": false,
350
+ "normalized": false,
351
+ "rstrip": false,
352
+ "single_word": false,
353
+ "special": true
354
+ },
355
+ "128044": {
356
+ "content": "__is__",
357
+ "lstrip": false,
358
+ "normalized": false,
359
+ "rstrip": false,
360
+ "single_word": false,
361
+ "special": true
362
+ },
363
+ "128045": {
364
+ "content": "__it__",
365
+ "lstrip": false,
366
+ "normalized": false,
367
+ "rstrip": false,
368
+ "single_word": false,
369
+ "special": true
370
+ },
371
+ "128046": {
372
+ "content": "__ja__",
373
+ "lstrip": false,
374
+ "normalized": false,
375
+ "rstrip": false,
376
+ "single_word": false,
377
+ "special": true
378
+ },
379
+ "128047": {
380
+ "content": "__jv__",
381
+ "lstrip": false,
382
+ "normalized": false,
383
+ "rstrip": false,
384
+ "single_word": false,
385
+ "special": true
386
+ },
387
+ "128048": {
388
+ "content": "__ka__",
389
+ "lstrip": false,
390
+ "normalized": false,
391
+ "rstrip": false,
392
+ "single_word": false,
393
+ "special": true
394
+ },
395
+ "128049": {
396
+ "content": "__kk__",
397
+ "lstrip": false,
398
+ "normalized": false,
399
+ "rstrip": false,
400
+ "single_word": false,
401
+ "special": true
402
+ },
403
+ "128050": {
404
+ "content": "__km__",
405
+ "lstrip": false,
406
+ "normalized": false,
407
+ "rstrip": false,
408
+ "single_word": false,
409
+ "special": true
410
+ },
411
+ "128051": {
412
+ "content": "__kn__",
413
+ "lstrip": false,
414
+ "normalized": false,
415
+ "rstrip": false,
416
+ "single_word": false,
417
+ "special": true
418
+ },
419
+ "128052": {
420
+ "content": "__ko__",
421
+ "lstrip": false,
422
+ "normalized": false,
423
+ "rstrip": false,
424
+ "single_word": false,
425
+ "special": true
426
+ },
427
+ "128053": {
428
+ "content": "__lb__",
429
+ "lstrip": false,
430
+ "normalized": false,
431
+ "rstrip": false,
432
+ "single_word": false,
433
+ "special": true
434
+ },
435
+ "128054": {
436
+ "content": "__lg__",
437
+ "lstrip": false,
438
+ "normalized": false,
439
+ "rstrip": false,
440
+ "single_word": false,
441
+ "special": true
442
+ },
443
+ "128055": {
444
+ "content": "__ln__",
445
+ "lstrip": false,
446
+ "normalized": false,
447
+ "rstrip": false,
448
+ "single_word": false,
449
+ "special": true
450
+ },
451
+ "128056": {
452
+ "content": "__lo__",
453
+ "lstrip": false,
454
+ "normalized": false,
455
+ "rstrip": false,
456
+ "single_word": false,
457
+ "special": true
458
+ },
459
+ "128057": {
460
+ "content": "__lt__",
461
+ "lstrip": false,
462
+ "normalized": false,
463
+ "rstrip": false,
464
+ "single_word": false,
465
+ "special": true
466
+ },
467
+ "128058": {
468
+ "content": "__lv__",
469
+ "lstrip": false,
470
+ "normalized": false,
471
+ "rstrip": false,
472
+ "single_word": false,
473
+ "special": true
474
+ },
475
+ "128059": {
476
+ "content": "__mg__",
477
+ "lstrip": false,
478
+ "normalized": false,
479
+ "rstrip": false,
480
+ "single_word": false,
481
+ "special": true
482
+ },
483
+ "128060": {
484
+ "content": "__mk__",
485
+ "lstrip": false,
486
+ "normalized": false,
487
+ "rstrip": false,
488
+ "single_word": false,
489
+ "special": true
490
+ },
491
+ "128061": {
492
+ "content": "__ml__",
493
+ "lstrip": false,
494
+ "normalized": false,
495
+ "rstrip": false,
496
+ "single_word": false,
497
+ "special": true
498
+ },
499
+ "128062": {
500
+ "content": "__mn__",
501
+ "lstrip": false,
502
+ "normalized": false,
503
+ "rstrip": false,
504
+ "single_word": false,
505
+ "special": true
506
+ },
507
+ "128063": {
508
+ "content": "__mr__",
509
+ "lstrip": false,
510
+ "normalized": false,
511
+ "rstrip": false,
512
+ "single_word": false,
513
+ "special": true
514
+ },
515
+ "128064": {
516
+ "content": "__ms__",
517
+ "lstrip": false,
518
+ "normalized": false,
519
+ "rstrip": false,
520
+ "single_word": false,
521
+ "special": true
522
+ },
523
+ "128065": {
524
+ "content": "__my__",
525
+ "lstrip": false,
526
+ "normalized": false,
527
+ "rstrip": false,
528
+ "single_word": false,
529
+ "special": true
530
+ },
531
+ "128066": {
532
+ "content": "__ne__",
533
+ "lstrip": false,
534
+ "normalized": false,
535
+ "rstrip": false,
536
+ "single_word": false,
537
+ "special": true
538
+ },
539
+ "128067": {
540
+ "content": "__nl__",
541
+ "lstrip": false,
542
+ "normalized": false,
543
+ "rstrip": false,
544
+ "single_word": false,
545
+ "special": true
546
+ },
547
+ "128068": {
548
+ "content": "__no__",
549
+ "lstrip": false,
550
+ "normalized": false,
551
+ "rstrip": false,
552
+ "single_word": false,
553
+ "special": true
554
+ },
555
+ "128069": {
556
+ "content": "__ns__",
557
+ "lstrip": false,
558
+ "normalized": false,
559
+ "rstrip": false,
560
+ "single_word": false,
561
+ "special": true
562
+ },
563
+ "128070": {
564
+ "content": "__oc__",
565
+ "lstrip": false,
566
+ "normalized": false,
567
+ "rstrip": false,
568
+ "single_word": false,
569
+ "special": true
570
+ },
571
+ "128071": {
572
+ "content": "__or__",
573
+ "lstrip": false,
574
+ "normalized": false,
575
+ "rstrip": false,
576
+ "single_word": false,
577
+ "special": true
578
+ },
579
+ "128072": {
580
+ "content": "__pa__",
581
+ "lstrip": false,
582
+ "normalized": false,
583
+ "rstrip": false,
584
+ "single_word": false,
585
+ "special": true
586
+ },
587
+ "128073": {
588
+ "content": "__pl__",
589
+ "lstrip": false,
590
+ "normalized": false,
591
+ "rstrip": false,
592
+ "single_word": false,
593
+ "special": true
594
+ },
595
+ "128074": {
596
+ "content": "__ps__",
597
+ "lstrip": false,
598
+ "normalized": false,
599
+ "rstrip": false,
600
+ "single_word": false,
601
+ "special": true
602
+ },
603
+ "128075": {
604
+ "content": "__pt__",
605
+ "lstrip": false,
606
+ "normalized": false,
607
+ "rstrip": false,
608
+ "single_word": false,
609
+ "special": true
610
+ },
611
+ "128076": {
612
+ "content": "__ro__",
613
+ "lstrip": false,
614
+ "normalized": false,
615
+ "rstrip": false,
616
+ "single_word": false,
617
+ "special": true
618
+ },
619
+ "128077": {
620
+ "content": "__ru__",
621
+ "lstrip": false,
622
+ "normalized": false,
623
+ "rstrip": false,
624
+ "single_word": false,
625
+ "special": true
626
+ },
627
+ "128078": {
628
+ "content": "__sd__",
629
+ "lstrip": false,
630
+ "normalized": false,
631
+ "rstrip": false,
632
+ "single_word": false,
633
+ "special": true
634
+ },
635
+ "128079": {
636
+ "content": "__si__",
637
+ "lstrip": false,
638
+ "normalized": false,
639
+ "rstrip": false,
640
+ "single_word": false,
641
+ "special": true
642
+ },
643
+ "128080": {
644
+ "content": "__sk__",
645
+ "lstrip": false,
646
+ "normalized": false,
647
+ "rstrip": false,
648
+ "single_word": false,
649
+ "special": true
650
+ },
651
+ "128081": {
652
+ "content": "__sl__",
653
+ "lstrip": false,
654
+ "normalized": false,
655
+ "rstrip": false,
656
+ "single_word": false,
657
+ "special": true
658
+ },
659
+ "128082": {
660
+ "content": "__so__",
661
+ "lstrip": false,
662
+ "normalized": false,
663
+ "rstrip": false,
664
+ "single_word": false,
665
+ "special": true
666
+ },
667
+ "128083": {
668
+ "content": "__sq__",
669
+ "lstrip": false,
670
+ "normalized": false,
671
+ "rstrip": false,
672
+ "single_word": false,
673
+ "special": true
674
+ },
675
+ "128084": {
676
+ "content": "__sr__",
677
+ "lstrip": false,
678
+ "normalized": false,
679
+ "rstrip": false,
680
+ "single_word": false,
681
+ "special": true
682
+ },
683
+ "128085": {
684
+ "content": "__ss__",
685
+ "lstrip": false,
686
+ "normalized": false,
687
+ "rstrip": false,
688
+ "single_word": false,
689
+ "special": true
690
+ },
691
+ "128086": {
692
+ "content": "__su__",
693
+ "lstrip": false,
694
+ "normalized": false,
695
+ "rstrip": false,
696
+ "single_word": false,
697
+ "special": true
698
+ },
699
+ "128087": {
700
+ "content": "__sv__",
701
+ "lstrip": false,
702
+ "normalized": false,
703
+ "rstrip": false,
704
+ "single_word": false,
705
+ "special": true
706
+ },
707
+ "128088": {
708
+ "content": "__sw__",
709
+ "lstrip": false,
710
+ "normalized": false,
711
+ "rstrip": false,
712
+ "single_word": false,
713
+ "special": true
714
+ },
715
+ "128089": {
716
+ "content": "__ta__",
717
+ "lstrip": false,
718
+ "normalized": false,
719
+ "rstrip": false,
720
+ "single_word": false,
721
+ "special": true
722
+ },
723
+ "128090": {
724
+ "content": "__th__",
725
+ "lstrip": false,
726
+ "normalized": false,
727
+ "rstrip": false,
728
+ "single_word": false,
729
+ "special": true
730
+ },
731
+ "128091": {
732
+ "content": "__tl__",
733
+ "lstrip": false,
734
+ "normalized": false,
735
+ "rstrip": false,
736
+ "single_word": false,
737
+ "special": true
738
+ },
739
+ "128092": {
740
+ "content": "__tn__",
741
+ "lstrip": false,
742
+ "normalized": false,
743
+ "rstrip": false,
744
+ "single_word": false,
745
+ "special": true
746
+ },
747
+ "128093": {
748
+ "content": "__tr__",
749
+ "lstrip": false,
750
+ "normalized": false,
751
+ "rstrip": false,
752
+ "single_word": false,
753
+ "special": true
754
+ },
755
+ "128094": {
756
+ "content": "__uk__",
757
+ "lstrip": false,
758
+ "normalized": false,
759
+ "rstrip": false,
760
+ "single_word": false,
761
+ "special": true
762
+ },
763
+ "128095": {
764
+ "content": "__ur__",
765
+ "lstrip": false,
766
+ "normalized": false,
767
+ "rstrip": false,
768
+ "single_word": false,
769
+ "special": true
770
+ },
771
+ "128096": {
772
+ "content": "__uz__",
773
+ "lstrip": false,
774
+ "normalized": false,
775
+ "rstrip": false,
776
+ "single_word": false,
777
+ "special": true
778
+ },
779
+ "128097": {
780
+ "content": "__vi__",
781
+ "lstrip": false,
782
+ "normalized": false,
783
+ "rstrip": false,
784
+ "single_word": false,
785
+ "special": true
786
+ },
787
+ "128098": {
788
+ "content": "__wo__",
789
+ "lstrip": false,
790
+ "normalized": false,
791
+ "rstrip": false,
792
+ "single_word": false,
793
+ "special": true
794
+ },
795
+ "128099": {
796
+ "content": "__xh__",
797
+ "lstrip": false,
798
+ "normalized": false,
799
+ "rstrip": false,
800
+ "single_word": false,
801
+ "special": true
802
+ },
803
+ "128100": {
804
+ "content": "__yi__",
805
+ "lstrip": false,
806
+ "normalized": false,
807
+ "rstrip": false,
808
+ "single_word": false,
809
+ "special": true
810
+ },
811
+ "128101": {
812
+ "content": "__yo__",
813
+ "lstrip": false,
814
+ "normalized": false,
815
+ "rstrip": false,
816
+ "single_word": false,
817
+ "special": true
818
+ },
819
+ "128102": {
820
+ "content": "__zh__",
821
+ "lstrip": false,
822
+ "normalized": false,
823
+ "rstrip": false,
824
+ "single_word": false,
825
+ "special": true
826
+ },
827
+ "128103": {
828
+ "content": "__zu__",
829
+ "lstrip": false,
830
+ "normalized": false,
831
+ "rstrip": false,
832
+ "single_word": false,
833
+ "special": true
834
+ }
835
+ },
836
+ "additional_special_tokens": [
837
+ "__af__",
838
+ "__am__",
839
+ "__ar__",
840
+ "__ast__",
841
+ "__az__",
842
+ "__ba__",
843
+ "__be__",
844
+ "__bg__",
845
+ "__bn__",
846
+ "__br__",
847
+ "__bs__",
848
+ "__ca__",
849
+ "__ceb__",
850
+ "__cs__",
851
+ "__cy__",
852
+ "__da__",
853
+ "__de__",
854
+ "__el__",
855
+ "__en__",
856
+ "__es__",
857
+ "__et__",
858
+ "__fa__",
859
+ "__ff__",
860
+ "__fi__",
861
+ "__fr__",
862
+ "__fy__",
863
+ "__ga__",
864
+ "__gd__",
865
+ "__gl__",
866
+ "__gu__",
867
+ "__ha__",
868
+ "__he__",
869
+ "__hi__",
870
+ "__hr__",
871
+ "__ht__",
872
+ "__hu__",
873
+ "__hy__",
874
+ "__id__",
875
+ "__ig__",
876
+ "__ilo__",
877
+ "__is__",
878
+ "__it__",
879
+ "__ja__",
880
+ "__jv__",
881
+ "__ka__",
882
+ "__kk__",
883
+ "__km__",
884
+ "__kn__",
885
+ "__ko__",
886
+ "__lb__",
887
+ "__lg__",
888
+ "__ln__",
889
+ "__lo__",
890
+ "__lt__",
891
+ "__lv__",
892
+ "__mg__",
893
+ "__mk__",
894
+ "__ml__",
895
+ "__mn__",
896
+ "__mr__",
897
+ "__ms__",
898
+ "__my__",
899
+ "__ne__",
900
+ "__nl__",
901
+ "__no__",
902
+ "__ns__",
903
+ "__oc__",
904
+ "__or__",
905
+ "__pa__",
906
+ "__pl__",
907
+ "__ps__",
908
+ "__pt__",
909
+ "__ro__",
910
+ "__ru__",
911
+ "__sd__",
912
+ "__si__",
913
+ "__sk__",
914
+ "__sl__",
915
+ "__so__",
916
+ "__sq__",
917
+ "__sr__",
918
+ "__ss__",
919
+ "__su__",
920
+ "__sv__",
921
+ "__sw__",
922
+ "__ta__",
923
+ "__th__",
924
+ "__tl__",
925
+ "__tn__",
926
+ "__tr__",
927
+ "__uk__",
928
+ "__ur__",
929
+ "__uz__",
930
+ "__vi__",
931
+ "__wo__",
932
+ "__xh__",
933
+ "__yi__",
934
+ "__yo__",
935
+ "__zh__",
936
+ "__zu__"
937
+ ],
938
+ "bos_token": "<s>",
939
+ "clean_up_tokenization_spaces": false,
940
+ "eos_token": "</s>",
941
+ "language_codes": "m2m100",
942
+ "model_max_length": 1024,
943
+ "num_madeup_words": 8,
944
+ "pad_token": "<pad>",
945
+ "sep_token": "</s>",
946
+ "sp_model_kwargs": {},
947
+ "src_lang": "en",
948
+ "tgt_lang": null,
949
+ "tokenizer_class": "M2M100Tokenizer",
950
+ "unk_token": "<unk>"
951
+ }
model/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ torch
2
+ tranformers
3
+ flask
4
+
5
+
static/styles.css ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* General Styling */
2
+ body {
3
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
4
+ background-color: #f9f9f9;
5
+ margin: 0;
6
+ padding: 0;
7
+ line-height: 1.6;
8
+ color: #333;
9
+ }
10
+
11
+ .container {
12
+ max-width: 800px;
13
+ margin: 50px auto;
14
+ padding: 20px;
15
+ background-color: #fff;
16
+ border-radius: 15px;
17
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
18
+ }
19
+
20
+ header h1 {
21
+ text-align: center;
22
+ font-size: 2.5rem;
23
+ color: #333;
24
+ margin-bottom: 20px;
25
+ }
26
+
27
+ form {
28
+ display: flex;
29
+ flex-direction: column;
30
+ gap: 15px;
31
+ margin-bottom: 30px;
32
+ }
33
+
34
+ textarea {
35
+ width: 100%;
36
+ padding: 12px;
37
+ font-size: 1rem;
38
+ border: 1px solid #ddd;
39
+ border-radius: 8px;
40
+ resize: vertical;
41
+ min-height: 150px;
42
+ box-sizing: border-box;
43
+ }
44
+
45
+ button.translate-btn {
46
+ position: relative;
47
+ padding: 15px;
48
+ font-size: 1.1rem;
49
+ font-weight: bold;
50
+ background-color: #4CAF50;
51
+ color: white;
52
+ border: none;
53
+ border-radius: 8px;
54
+ cursor: pointer;
55
+ transition: background-color 0.3s ease;
56
+ }
57
+
58
+ button.translate-btn:hover {
59
+ background-color: #45a049;
60
+ }
61
+
62
+ button.translate-btn[disabled] {
63
+ background-color: #8bc34a;
64
+ cursor: not-allowed;
65
+ }
66
+
67
+ .spinner {
68
+ position: absolute;
69
+ right: 20px;
70
+ top: 50%;
71
+ width: 20px;
72
+ height: 20px;
73
+ margin-top: -10px;
74
+ border: 3px solid rgba(255, 255, 255, 0.6);
75
+ border-top: 3px solid #fff;
76
+ border-radius: 50%;
77
+ animation: spin 1s linear infinite;
78
+ }
79
+
80
+ .hidden {
81
+ display: none;
82
+ }
83
+
84
+ @keyframes spin {
85
+ from {
86
+ transform: rotate(0deg);
87
+ }
88
+ to {
89
+ transform: rotate(360deg);
90
+ }
91
+ }
92
+
93
+ /* Responsive Styling */
94
+
95
+ @media screen and (max-width: 768px) {
96
+ /* Other responsive styles remain the same */
97
+ }
98
+
99
+ /* ... */
templates/index.html ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Prakrit to English Translation</title>
7
+ <link rel="stylesheet" href="/static/styles.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <header>
12
+ <h1>Maharashtri Prakrit to English Translator</h1>
13
+ </header>
14
+ <main>
15
+ <form action="/translate" method="POST" id="translation-form">
16
+ <div class="form-group">
17
+ <label for="prakrit_text">Enter Prakrit Sentence:</label>
18
+ <textarea name="prakrit_text" id="prakrit_text" rows="4" required></textarea>
19
+ </div>
20
+ <button type="submit" class="translate-btn" id="translate-btn">
21
+ <span id="btn-text">Translate</span>
22
+ <span id="loading-spinner" class="spinner hidden"></span>
23
+ </button>
24
+ </form>
25
+
26
+ {% if original_text %}
27
+ <section class="translation-result">
28
+ <h2>Prakrit Text:</h2>
29
+ <p>{{ original_text }}</p>
30
+
31
+ <h2>Translated English Text:</h2>
32
+ <p>{{ translated_text }}</p>
33
+
34
+ <h3>Translation Time: {{ time_taken }} seconds</h3>
35
+ </section>
36
+ {% endif %}
37
+ </main>
38
+ </div>
39
+
40
+ <script>
41
+ // Add event listener to the form
42
+ document.getElementById('translation-form').addEventListener('submit', function() {
43
+ // Show loading spinner
44
+ document.getElementById('loading-spinner').classList.remove('hidden');
45
+ // Change button text to 'Translating...'
46
+ document.getElementById('btn-text').textContent = 'Translating...';
47
+ // Disable the button to prevent multiple submissions
48
+ document.getElementById('translate-btn').setAttribute('disabled', 'true');
49
+ });
50
+
51
+ // Assuming that after the translation, the page reloads with new content.
52
+ // You can customize this based on your specific backend process (AJAX, etc.)
53
+ </script>
54
+ </body>
55
+ </html>
translation_model.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ from transformers import pipeline
3
+
4
+ # Load the translation model at the start to avoid reloading on each request
5
+ start_time = time.time()
6
+ pipe = pipeline("text2text-generation", model="model")
7
+ print(f"Model loaded in {time.time() - start_time} seconds")
8
+
9
+ def translate(input_text):
10
+ print(f"Input text: {input_text}")
11
+ output_text = pipe(
12
+ input_text,
13
+ do_sample=True,
14
+ num_beams=5,
15
+ max_length=50,
16
+ no_repeat_ngram_size=2,
17
+ temperature=0.7
18
+ )
19
+ translated_text = output_text[0]['generated_text']
20
+ print(f"Output text: {translated_text}")
21
+ return translated_text