Update README.md
Browse files
README.md
CHANGED
|
@@ -1,146 +1,71 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
---
|
| 7 |
|
| 8 |
-
##
|
| 9 |
|
| 10 |
-
- **Author:** Mikiyas Zenebe
|
| 11 |
-
- **Model type:** Seq2Seq (Encoder + Decoder)
|
| 12 |
- **Framework:** PyTorch
|
| 13 |
-
- **Source
|
| 14 |
-
- **Target language:** English
|
| 15 |
- **License:** Apache 2.0
|
| 16 |
-
- **Trained with:** official PyTorch translation tutorial structure
|
| 17 |
-
- **Uploaded on:** Hugging Face Hub (`Mikile/Bertha-translation`)
|
| 18 |
|
| 19 |
---
|
| 20 |
|
| 21 |
-
##
|
| 22 |
|
| 23 |
```python
|
| 24 |
import torch
|
| 25 |
-
from model import EncoderRNN, DecoderRNN # your model classes
|
| 26 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 27 |
|
| 28 |
# Download trained models
|
| 29 |
encoder_path = hf_hub_download("Mikile/Bertha-translation", "encoder.pth")
|
| 30 |
decoder_path = hf_hub_download("Mikile/Bertha-translation", "decoder.pth")
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 53 |
-
|
| 54 |
-
### Testing Data, Factors & Metrics
|
| 55 |
-
|
| 56 |
-
#### Testing Data
|
| 57 |
-
|
| 58 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 59 |
-
|
| 60 |
-
[More Information Needed]
|
| 61 |
-
|
| 62 |
-
#### Factors
|
| 63 |
-
|
| 64 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 65 |
-
|
| 66 |
-
[More Information Needed]
|
| 67 |
-
|
| 68 |
-
#### Metrics
|
| 69 |
-
|
| 70 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 71 |
-
|
| 72 |
-
[More Information Needed]
|
| 73 |
-
|
| 74 |
-
### Results
|
| 75 |
-
|
| 76 |
-
[More Information Needed]
|
| 77 |
-
|
| 78 |
-
#### Summary
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
## Model Examination [optional]
|
| 83 |
-
|
| 84 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 85 |
-
|
| 86 |
-
[More Information Needed]
|
| 87 |
-
|
| 88 |
-
## Environmental Impact
|
| 89 |
-
|
| 90 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 91 |
-
|
| 92 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 93 |
-
|
| 94 |
-
- **Hardware Type:** [More Information Needed]
|
| 95 |
-
- **Hours used:** [More Information Needed]
|
| 96 |
-
- **Cloud Provider:** [More Information Needed]
|
| 97 |
-
- **Compute Region:** [More Information Needed]
|
| 98 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 99 |
-
|
| 100 |
-
## Technical Specifications [optional]
|
| 101 |
-
|
| 102 |
-
### Model Architecture and Objective
|
| 103 |
-
|
| 104 |
-
[More Information Needed]
|
| 105 |
-
|
| 106 |
-
### Compute Infrastructure
|
| 107 |
-
|
| 108 |
-
[More Information Needed]
|
| 109 |
-
|
| 110 |
-
#### Hardware
|
| 111 |
-
|
| 112 |
-
[More Information Needed]
|
| 113 |
-
|
| 114 |
-
#### Software
|
| 115 |
-
|
| 116 |
-
[More Information Needed]
|
| 117 |
-
|
| 118 |
-
## Citation [optional]
|
| 119 |
-
|
| 120 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 121 |
-
|
| 122 |
-
**BibTeX:**
|
| 123 |
-
|
| 124 |
-
[More Information Needed]
|
| 125 |
-
|
| 126 |
-
**APA:**
|
| 127 |
-
|
| 128 |
-
[More Information Needed]
|
| 129 |
-
|
| 130 |
-
## Glossary [optional]
|
| 131 |
-
|
| 132 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 133 |
-
|
| 134 |
-
[More Information Needed]
|
| 135 |
-
|
| 136 |
-
## More Information [optional]
|
| 137 |
-
|
| 138 |
-
[More Information Needed]
|
| 139 |
-
|
| 140 |
-
## Model Card Authors [optional]
|
| 141 |
-
|
| 142 |
-
[More Information Needed]
|
| 143 |
-
|
| 144 |
-
## Model Card Contact
|
| 145 |
-
|
| 146 |
-
[More Information Needed]
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: ["en", "ber"]
|
| 3 |
+
license: "apache-2.0"
|
| 4 |
+
tags:
|
| 5 |
+
- translation
|
| 6 |
+
- seq2seq
|
| 7 |
+
- machine-translation
|
| 8 |
+
- pytorch
|
| 9 |
+
widget:
|
| 10 |
+
- text: "Hello my friend"
|
| 11 |
+
- text: "How are you?"
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Bertha ↔ English Translator
|
| 15 |
+
|
| 16 |
+
**Bertha-Translation** is a bilingual Seq2Seq neural machine translation model that translates text **between English and Bertha**.
|
| 17 |
+
It uses an **Encoder–Decoder GRU architecture with attention**.
|
| 18 |
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
## Features
|
| 22 |
+
|
| 23 |
+
- Translate **English → Bertha**
|
| 24 |
+
- Translate **Bertha → English**
|
| 25 |
+
- Bidirectional Seq2Seq model with attention
|
| 26 |
+
- Built with PyTorch following the official Seq2Seq tutorial
|
| 27 |
+
- Lightweight and suitable for low-latency translation
|
| 28 |
|
| 29 |
---
|
| 30 |
|
| 31 |
+
## Model Details
|
| 32 |
|
| 33 |
+
- **Author:** Mikiyas Zenebe
|
| 34 |
+
- **Model type:** Seq2Seq (Encoder + Decoder with Attention)
|
| 35 |
- **Framework:** PyTorch
|
| 36 |
+
- **Source / Target languages:** English, Bertha
|
|
|
|
| 37 |
- **License:** Apache 2.0
|
|
|
|
|
|
|
| 38 |
|
| 39 |
---
|
| 40 |
|
| 41 |
+
## Usage Example
|
| 42 |
|
| 43 |
```python
|
| 44 |
import torch
|
|
|
|
| 45 |
from huggingface_hub import hf_hub_download
|
| 46 |
+
from model import EncoderRNN, DecoderRNN, tensorFromSentence
|
| 47 |
|
| 48 |
# Download trained models
|
| 49 |
encoder_path = hf_hub_download("Mikile/Bertha-translation", "encoder.pth")
|
| 50 |
decoder_path = hf_hub_download("Mikile/Bertha-translation", "decoder.pth")
|
| 51 |
|
| 52 |
+
# Load your encoder and decoder
|
| 53 |
+
encoder = EncoderRNN(input_size, hidden_size)
|
| 54 |
+
decoder = DecoderRNN(hidden_size, output_size)
|
| 55 |
+
encoder.load_state_dict(torch.load(encoder_path))
|
| 56 |
+
decoder.load_state_dict(torch.load(decoder_path))
|
| 57 |
+
|
| 58 |
+
# Translate a sentence
|
| 59 |
+
sentence = "hello my friend"
|
| 60 |
+
input_tensor = tensorFromSentence(input_lang, sentence)
|
| 61 |
+
encoder_outputs, encoder_hidden = encoder(input_tensor)
|
| 62 |
+
decoder_outputs, _, _ = decoder(encoder_outputs, encoder_hidden)
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
@misc{bertha_translation,
|
| 66 |
+
author = {Mikiyas Zenebe},
|
| 67 |
+
title = {Bertha ↔ English Translation Model},
|
| 68 |
+
year = {2025},
|
| 69 |
+
howpublished = {Hugging Face Model Hub},
|
| 70 |
+
url = {https://huggingface.co/Mikile/Bertha-translation}
|
| 71 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|