peft safetensors translation transformers en fr dataset:opus100 base_model:t5-small license:apache-2.0 region:us
---
library_name: peft
base_model: t5-small
license: apache-2.0
datasets:
- opus100
tags:
- translation
- safetensors
- transformers
language:
- en
- fr
---

# Model Card for Model ID

A language translation model fine-tuned on **opus100** dataset for *English to French* translation.


## Model Description

- **Model type:** Language Model
- **Language(s) (NLP):** English, French
- **License:** Apache 2.0
- **Finetuned from model:** [T5-small](https://huggingface.co/t5-small)


## Uses

The model is intended to use for English to French translation related tasks. 


## How to Get Started with the Model


Install necessary libraries
```
pip install transformers peft accelerate
```
Use the code below to get started with the model.

```python
from peft import PeftModel, PeftConfig
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("dmedhi/eng2french-t5-small")
model = AutoModelForSeq2SeqLM.from_pretrained("t5-small")
model = PeftModel.from_pretrained(model, "dmedhi/eng2french-t5-small")

context = tokenizer(["Do you want coffee?"], return_tensors='pt')
output = model.generate(**context)
result = tokenizer.decode(output[0], skip_special_tokens=True)
print(result)

# Output
# Tu veux du café?

```

## Training Details

### Training Data

- Dataset used: [Opus100](https://huggingface.co/datasets/opus100)
- Subset: "en-fr"


## Evaluation

- global_step=5000
- training_loss=1.295289501953125

#### Metrics
- train_runtime = 1672.4371
- train_samples_per_second = 23.917
- train_steps_per_second = 2.99
- total_flos = 685071170273280.0 
- train_loss = 1.295289501953125
- epoch = 20.0


## Compute Instance
- Google Colab - T4 GPU (Free)


### Framework versions

- PEFT 0.7.1