Gemago-2b / README.md
DevWorld's picture
Update README.md
1219e41 verified
|
raw
history blame
2.35 kB
metadata
license:
  - apache-2.0
  - gemma
datasets:
  - traintogpb/aihub-koen-translation-integrated-base-10m
language:
  - ko
  - en
pipeline_tag: translation
tags:
  - gemma
widget:
  - text: |
      Korean:
      나라의 말이 중국과 달라 문자와 서로 통하지 아니하다.

      English:
    example_title: K2E
  - text: |
      English:
      Mr. and Mrs. Dursley were proud to say that they were perfectly normal.

      Korean:
    example_title: E2K
inference:
  parameters:
    max_length: 200

Gemago 2B Model Card

Original Gemma Model Page: Gemma

Model Page On Github: Gemago

Resources and Technical Documentation:

Terms of Use: Terms

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 transformers, then copy the snippet from the section that is relevant for your usecase.

Running the model with transformers

Open In Colab

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)