📋 Model Description
Quantization made by Richard Erkhov.
gemma-2-2b-jpn-it - GGUF
- Model creator: https://huggingface.co/google/
- Original model: https://huggingface.co/google/gemma-2-2b-jpn-it/
| Name | Quant method | Size |
|---|---|---|
| gemma-2-2b-jpn-it.Q2K.gguf | Q2K | 1.15GB |
| gemma-2-2b-jpn-it.IQ3XS.gguf | IQ3XS | 1.22GB |
| gemma-2-2b-jpn-it.IQ3S.gguf | IQ3S | 1.27GB |
| gemma-2-2b-jpn-it.Q3KS.gguf | Q3K_S | 1.27GB |
| gemma-2-2b-jpn-it.IQ3M.gguf | IQ3M | 1.3GB |
| gemma-2-2b-jpn-it.Q3K.gguf | Q3K | 1.36GB |
| gemma-2-2b-jpn-it.Q3KM.gguf | Q3K_M | 1.36GB |
| gemma-2-2b-jpn-it.Q3KL.gguf | Q3K_L | 1.44GB |
| gemma-2-2b-jpn-it.IQ4XS.gguf | IQ4XS | 1.47GB |
| gemma-2-2b-jpn-it.Q40.gguf | Q40 | 1.52GB |
| gemma-2-2b-jpn-it.IQ4NL.gguf | IQ4NL | 1.53GB |
| gemma-2-2b-jpn-it.Q4KS.gguf | Q4K_S | 1.53GB |
| gemma-2-2b-jpn-it.Q4K.gguf | Q4K | 1.59GB |
| gemma-2-2b-jpn-it.Q4KM.gguf | Q4K_M | 1.59GB |
| gemma-2-2b-jpn-it.Q41.gguf | Q41 | 1.64GB |
| gemma-2-2b-jpn-it.Q50.gguf | Q50 | 1.75GB |
| gemma-2-2b-jpn-it.Q5KS.gguf | Q5K_S | 1.75GB |
| gemma-2-2b-jpn-it.Q5K.gguf | Q5K | 1.79GB |
| gemma-2-2b-jpn-it.Q5KM.gguf | Q5K_M | 1.79GB |
| gemma-2-2b-jpn-it.Q51.gguf | Q51 | 1.87GB |
| gemma-2-2b-jpn-it.Q6K.gguf | Q6K | 2.0GB |
| gemma-2-2b-jpn-it.Q80.gguf | Q80 | 2.59GB |
Original model description:
license: gemma
library_name: transformers
pipeline_tag: text-generation
extragatedheading: Access Gemma on Hugging Face
extragatedprompt: >-
To access Gemma on Hugging Face, you’re required to review and agree to
Google’s usage license. To do this, please ensure you’re logged in to Hugging
Face and click below. Requests are processed immediately.
extragatedbutton_content: Acknowledge license
tags:
- conversational
base_model: google/gemma-2-2b-it
language:
- ja
Gemma 2 JPN model card
Resources and Technical Documentation:
Terms of Use: Terms\
Authors: Google
Model Information
Summary description and brief definition of inputs and outputs.
Description
Gemma is a series of best-in-class open models and draws inspiration and
technological lineage from the Gemini family of models. They are text-to-text,
decoder-only large language models with open weights. Gemma models are
well-suited for a variety of text generation tasks, including question
answering, summarization, and reasoning.
Gemma-2-JPN is a Gemma 2 2B model fine-tuned on Japanese text. It supports the
Japanese language with the same level of performance of English only queries on
Gemma 2.
Usage
Below we share some code snippets on how to get quickly started with running the model. First, install the Transformers library with:
pip install -U transformers
Then, copy the snippet from the section that is relevant for your usecase.
#### Running with the pipeline API
import torch
from transformers import pipeline
pipe = pipeline(
"text-generation",
model="google/gemma-2-2b-jpn-it",
modelkwargs={"torchdtype": torch.bfloat16},
device="cuda", # replace with "mps" to run on a Mac device
)
messages = [
{"role": "user", "content": "マシーンラーニングについての詩を書いてください。"},
]
outputs = pipe(messages, returnfulltext=False, maxnewtokens=256)
assistantresponse = outputs[0]["generatedtext"].strip()
print(assistant_response)
Example output
## マシーンラーニングの詩
1.
データの海、深淵の広がり、
複雑なパターン、隠された知識。
機械学習、その力強さ、
未来を予測、その道を開く。
2.
ニューラルネットワーク、複雑な枝、
学習の旅、その過程は静か。
データから学び、進化する姿、
予測の精度、その力強さ。
3.
教師あり学習、正解を導く、
教師なし学習、未知の世界へ。
機械学習、その進化は止まらない、
未来の扉を開く、新たな時代へ。
4.
画像認識、音声認識、
複雑なタスク、その答えを見つける。
機械学習、その力強さ、
未来の技術、その可能性を語る。
It can also be used for translation, as follows:
translationinputtext = f"Translate the following poem from Japanese to English:\n\n{assistant_response}"
messages = [
{"role": "user", "content": translationinputtext},
]
outputs = pipe(messages, returnfulltext=False, maxnewtokens=1024)
translatedresponse = outputs[0]["generatedtext"].strip()
print(translated_response)
## A Poem About Machine Learning
1.
A vast ocean of data, a deep expanse,
Complex patterns, hidden knowledge.
Machine learning, its strength so vast,
Predicting the future, opening the way.
2.
A neural network, with branches intricate,
A journey of learning, its process serene.
Learning from data, evolving in its form,
The precision of prediction, its strength.
3.
Supervised learning, guiding the correct answer,
Unsupervised learning, venturing into the unknown.
Machine learning, its evolution never ends,
Opening the doors to the future, a new era.
4.
Image recognition, speech recognition,
Complex tasks, finding the answer.
Machine learning, its strength so vast,
The possibilities of future technology, a story to be told.
Explanation:
The poem uses vivid imagery and metaphors to describe the power and potential of machine learning.
- Data as an ocean: Represents the vast amount of information available for learning.
- Complex patterns: Highlights the intricate nature of data and the challenges of extracting meaningful insights.
- Future prediction: Emphasizes the ability of machine learning to analyze data and make predictions about the future.
- Neural network as a tree: Represents the interconnectedness and complexity of the learning process.
- Learning from data: Focuses on the core principle of machine learning, where algorithms learn from data to improve their performance.
The poem concludes by highlighting the diverse applications of machine learning, such as image and speech recognition, and emphasizes its potential to shape the future of technology.
#### Running the model on a single / multi GPU
# pip install accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-2b-jpn-it")
model = AutoModelForCausalLM.from_pretrained(
"google/gemma-2-2b-jpn-it",
device_map="auto",
torch_dtype=torch.bfloat16,
)
messages = [
{"role": "user", "content": "マシーンラーニングについての詩を書いてください。"},
]
inputs = tokenizer.applychattemplate(messages, returntensors="pt", addgenerationprompt=True, returndict=True).to(model.device)
outputs = model.generate(inputs, maxnewtokens=256)
generatedtext = tokenizer.batchdecode(outputs[:, inputs['inputids'].shape[1]:], skipspecial_tokens=True)[0]
print(generated_text.strip())
#### Running the model on a GPU using different precisions
The native weights of this model were exported in bfloat16 precision.
You can also use float32 if you skip the dtype, but no precision increase will occur (model weights will just be upcasted to float32). See examples below.
- Upcasting to
torch.float32
# pip install accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-2b-jpn-it")
model = AutoModelForCausalLM.from_pretrained(
"google/gemma-2-2b-jpn-it",
device_map="auto",
)
messages = [
{"role": "user", "content": "マシーンラーニングについての詩を書いてください。"},
]
inputs = tokenizer.applychattemplate(messages, returntensors="pt", addgenerationprompt=True, returndict=True).to(model.device)
outputs = model.generate(inputs, maxnewtokens=256)
generatedtext = tokenizer.batchdecode(outputs[:, inputs['inputids'].shape[1]:], skipspecial_tokens=True)[0]
print(generated_text.strip())
Inputs and outputs
- Input: Text string, such as a question, a prompt, or a document to
- Output: Generated Japanese-language text in response to the input,
Model Data
Data used for model training and how the data was processed.
Training Dataset
These models were trained on a dataset of text data that includes a wide
variety of sources, totaling 8 trillion tokens. Here are the key components:
- Web Documents: A diverse collection of web text ensures the model is
- Code: Exposing the model to code helps it to learn the syntax and
- Mathematics: Training on mathematical text helps the model learn logical
- Instruction data set: large-scale and high-quality Japanese and
The combination of these diverse data sources is crucial for training a
powerful language model that can handle a wide variety of different tasks and
text formats.
Data Preprocessing
Here are the key data cleaning and filtering methods applied to the training
data:
- CSAM Filtering: Rigorous CSAM (Child Sexual Abuse Material) filtering
- Sensitive Data Filtering: As part of making Gemma pre-trained models
- Additional methods: Filtering based on content quality and
Implementation Information
Details about the model internals.
Hardware
Gemma was trained using the latest generation of Tensor Processing Unit
(TPU) hardware (TPUv5p).
Training large language models requires significant computational power. TPUs,
designed specifically for matrix operations common in machine learning, offer
several advantages in this domain:
- Performance: TPUs are specifically designed to handle the massive
- Memory: TPUs often come with large amounts of high-bandwidth memory,
- Scalability: TPU Pods (large clusters of TPUs) provide a scalable
- Cost-effectiveness: In many scenarios, TPUs can provide a more
These advantages are aligned with
Google's commitments to operate sustainably.
Software
Training was done using JAX and
ML Pathways.
JAX allows researchers to take advantage of the latest generation of hardware,
including TPUs, for faster and more efficient training of large models.
ML Pathways is Google's latest effort to build artificially intelligent systems
capable of generalizing across multiple tasks. This is specially suitable for
foundation models, including
large language models like these ones.
Together, JAX and ML Pathways are used as described in the paper about the
Gemini family of models; "the 'single controller'
programming model of Jax and Pathways allows a single Python process to
orchestrate the entire training run, dramatically simplifying the development
workflow."
Evaluation
To assess the quality of this model, we collected a diverse set of Japanese
prompts and evaluated performance using an LLM-as-a-judge approach against
GPT-3.5. The rating system is based on a 7-scale assessments, which are
MuchBetterThan, BetterThan, SlightlyBetterThan, AboutTheSame, SlightlyWorse,
WorseThan, MuchWorseThan associated with the numerical scores 1.5, 1.0, 0.5, 0,
-0.5, -1.0, -1.5 respectively. We also tracked the ability of the model to
answer in the correct language: for a Japanese prompt, the model should
typically answer in Japanese rather than defaulting to English.
Benchmark |
Gemma-2-IT |
Gemma-2-IT-JPN |
|
|---|---|---|---|
Preference vs GPT-3.5 |
-0.25 ± 0.05 |
0.03 ± 0.04 |
|
Language correctness |
86.47% |
98.24% |
Ethics and Safety
Ethics and safety evaluation approach and results.
Evaluation Approach
Our evaluation methods include structured evaluations and internal red-teaming
testing of relevant content policies. Red-teaming was conducted by a number of
different teams, each with different goals and human evaluation metrics. These
models were evaluated against a number of different categories relevant to
ethics and safety, including:
- Text-to-Text Content Safety: Human evaluation on prompts covering
- Text-to-Text Representational Harms: Benchmark against relevant academic
- Memorization: Automated evaluation of memorization of training data,
- Large-scale harm: Tests for "dangerous capabilities," such as chemical,
Usage and Limitations
These models have certain limitations that users should be aware of.
Intended Usage
Open Large Language Models (LLMs) have a wide range of applications across
various industries and domains. The following list of potential uses is not
comprehensive. The purpose of this list is to provide contextual information
about the possible use-cases that the model creators considered as part of model
training and development.
- Content Creation and Communication
- Research and Education
Limitations
- Training Data
- Context and Task Complexity
- Language Ambiguity and Nuance
- Factual Accuracy
- Common Sense
Ethical Considerations and Risks
The development of large language models (LLMs) raises several ethical
concerns. In creating an open model, we have carefully considered the
following:
- Bias and Fairness
- Misinformation and Misuse
- Transparency and Accountability:
Risks identified and mitigations:
- Perpetuation of biases: It's encouraged to perform continuous
- Generation of harmful content: Mechanisms and guidelines for content
- Misuse for malicious purposes: Technical limitations and developer and
- Privacy violations: Models were trained on data filtered for removal of
Benefits
At the time of release, this family of models provides high-performance open
large language model implementations designed from the ground up for Responsible
AI development compared to similarly sized models.
📂 GGUF File List
| 📁 Filename | 📦 Size | ⚡ Download |
|---|---|---|
|
gemma-2-2b-jpn-it.IQ3_M.gguf
LFS
Q3
|
1.3 GB | Download |
|
gemma-2-2b-jpn-it.IQ3_S.gguf
LFS
Q3
|
1.27 GB | Download |
|
gemma-2-2b-jpn-it.IQ3_XS.gguf
LFS
Q3
|
1.22 GB | Download |
|
gemma-2-2b-jpn-it.IQ4_NL.gguf
LFS
Q4
|
1.53 GB | Download |
|
gemma-2-2b-jpn-it.IQ4_XS.gguf
LFS
Q4
|
1.47 GB | Download |
|
gemma-2-2b-jpn-it.Q2_K.gguf
LFS
Q2
|
1.15 GB | Download |
|
gemma-2-2b-jpn-it.Q3_K.gguf
LFS
Q3
|
1.36 GB | Download |
|
gemma-2-2b-jpn-it.Q3_K_L.gguf
LFS
Q3
|
1.44 GB | Download |
|
gemma-2-2b-jpn-it.Q3_K_M.gguf
LFS
Q3
|
1.36 GB | Download |
|
gemma-2-2b-jpn-it.Q3_K_S.gguf
LFS
Q3
|
1.27 GB | Download |
|
gemma-2-2b-jpn-it.Q4_0.gguf
Recommended
LFS
Q4
|
1.52 GB | Download |
|
gemma-2-2b-jpn-it.Q4_1.gguf
LFS
Q4
|
1.64 GB | Download |
|
gemma-2-2b-jpn-it.Q4_K.gguf
LFS
Q4
|
1.59 GB | Download |
|
gemma-2-2b-jpn-it.Q4_K_M.gguf
LFS
Q4
|
1.59 GB | Download |
|
gemma-2-2b-jpn-it.Q4_K_S.gguf
LFS
Q4
|
1.53 GB | Download |
|
gemma-2-2b-jpn-it.Q5_0.gguf
LFS
Q5
|
1.75 GB | Download |
|
gemma-2-2b-jpn-it.Q5_1.gguf
LFS
Q5
|
1.87 GB | Download |
|
gemma-2-2b-jpn-it.Q5_K.gguf
LFS
Q5
|
1.79 GB | Download |
|
gemma-2-2b-jpn-it.Q5_K_M.gguf
LFS
Q5
|
1.79 GB | Download |
|
gemma-2-2b-jpn-it.Q5_K_S.gguf
LFS
Q5
|
1.75 GB | Download |
|
gemma-2-2b-jpn-it.Q6_K.gguf
LFS
Q6
|
2 GB | Download |
|
gemma-2-2b-jpn-it.Q8_0.gguf
LFS
Q8
|
2.59 GB | Download |