File size: 2,899 Bytes
b93626f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
edf6aaa
 
 
4bda77a
e8f6c29
edf6aaa
b93626f
 
edf6aaa
b93626f
 
 
 
 
 
edf6aaa
b93626f
 
 
edf6aaa
b93626f
 
 
edf6aaa
 
b93626f
 
 
 
 
 
 
 
 
 
 
 
 
edf6aaa
 
 
 
 
b93626f
edf6aaa
b93626f
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
license: apache-2.0
base_model: Helsinki-NLP/opus-mt-en-fr
tags:
- translation
- generated_from_trainer
datasets:
- kde4
metrics:
- bleu
model-index:
- name: model-en-to-fr-1
  results:
  - task:
      name: Sequence-to-sequence Language Modeling
      type: text2text-generation
    dataset:
      name: kde4
      type: kde4
      config: en-fr
      split: train
      args: en-fr
    metrics:
    - name: Bleu
      type: bleu
      value: 53.426719374274924
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# Introduction

I have made a working user interactive Gradio Language Translation model which translates any English sentence into French sentence. For this i have fine tuned a pre trained model which i have used from HuggingFace.
Make a local directory of this repo in your computer using git clone function on your terminal and then in your terminal switch to the directory of this repo on your computer and then just type python gradio_LT.py to start the user interface for translation.
I have saved the code in LS_Project_LT.ipynb

# model-en-to-fr-1

This model is a fine-tuned version of [Helsinki-NLP/opus-mt-en-fr](https://huggingface.co/Helsinki-NLP/opus-mt-en-fr) on the kde4 dataset. I have used this model to convert English sentence to French.
It achieves the following results on the evaluation set:
- Loss: 0.8447
- Bleu: 53.4267

## Model description

I have used the inbuilt features of transformers to make this model. The model is made from AutoModelForSeq2SeqLM and i have tokenized the dataset accoding to the pre trained model.

## Training and evaluation data

I have used the Sacrebleu method to evaluate my model which is generally used in language translation. It compares the number of common words in predicted and correct output and then gives its correctness.

## Training procedure

I have used the Seq2SeqTrainer function to train my dataset over the pre trained model.The specific parameters are given below which i have used.

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 3e-05
- train_batch_size: 32
- eval_batch_size: 64
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 3

### Training results

The model achieves the following results on the evaluation set:
- Loss: 0.8447
- Bleu: 53.4267

### Gradio Interface

I have made a separate file gradio_LT.py. By running this file you will directly see a gradio user interface through which you translate sentences. The only prerequisite is that transformers, gradio, sentencepiece should be pre downloaded in your environment.

### Framework versions

- Transformers 4.31.0
- Pytorch 2.0.1+cu118
- Datasets 2.14.4
- Tokenizers 0.13.3