File size: 2,038 Bytes
b20e65d
83cfecc
 
 
 
 
 
 
 
 
b20e65d
046a589
83cfecc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: [apache-2.0, gemma]
datasets:
- traintogpb/aihub-koen-translation-integrated-base-10m
language:
- ko
- en
pipeline_tag: translation
tags:
- gemma
---
# Gemago 2B Model Card

**Original Gemma Model Page**: [Gemma](https://ai.google.dev/gemma/docs)

**Model Page On Github**: [Gemago](https://github.com/deveworld/Gemago)

**Resources and Technical Documentation**:
* [Blog(Korean)](https://blog.worldsw.dev/tag/gemago/)
* [Original Google's Gemma-2B](https://huggingface.co/google/gemma-2b)
* [Training Code @ Github: Gemma-EasyLM (Orginial by Beomi)](https://github.com/deveworld/Gemma-EasyLM/tree/2b)

**Terms of Use**: [Terms](https://www.kaggle.com/models/google/gemma/license/consent)

**Authors**: Orginal Google, Fine-tuned by DevWorld

## Model Information

Translate English/Korean to Korean/English.

### Description

Gemago is a lightweight English-and-Korean translation model based on Gemma.

### Context Length
Models are trained on a context length of 8192 tokens, which is equivalent to Gemma.

### Usage

Below we share some code snippets on how to get quickly started with running the model. First make sure to `pip install -U keras keras-nlp`, then copy the snippet from the section that is relevant for your usecase.

#### Running the model with transformers
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deveworld/Gemago/blob/main/Gemago_2b_Infer.ipynb)

```python
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("devworld/gemago-2b")
model = AutoModelForCausalLM.from_pretrained("devworld/gemago-2b")

def gen(text, max_length):
    input_ids = tokenizer(text, return_tensors="pt")
    outputs = model.generate(**input_ids, max_length=max_length)
    return tokenizer.decode(outputs[0])

def e2k(e):
    input_text = f"English:\n{e}\n\nKorean:\n"
    return gen(input_text, 1024)

def k2e(k):
    input_text = f"Korean:\n{k}\n\nEnglish:\n"
    return gen(input_text, 1024)
```