Downloads · 30 days
0
ec-kim/gemma2-tongue-twister-generator
gemma2-tongue-twister-generator is a text generation model from ec-kim. Use it when you need the model to write or continue text. The card lists the license as gemma.
You can try the Tongue Twister Generator in the Hugging Face Space - Tongue Twister Generator with TTS.
Downloads · 30 days
0
Access
Public
Updated Sep 27, 2024
Repo size
31.8 MB
Likes
0
Public
Click a slice to open those files.
.json17.6 MB · 55%
From the Hugging Face model README
You can try the Tongue Twister Generator in the Hugging Face Space - Tongue Twister Generator with TTS.
<br>google/gemma-2-2b-itThe gemma2-tongue-twister-generator is a fine-tuned version of the Gemma 2 2B model. It is specifically trained to generate creative and challenging tongue twisters based on given keywords or prompts. The model can create intricate wordplays with rhythmic patterns, making it ideal for educational and entertainment purposes, such as helping individuals practice speech articulation and fluency.
Dataset: The model was fine-tuned on a dataset of 1,900 English tongue twisters, where each example contains a prompt (keywords or questions) and an answer (a tongue twister). The dataset is based on examples found in the paper "TongueTwister Games: A New Benchmark and Dataset for Word Play Generation" published at ACL 2023.
"Generate tongue twisters about key words: sea seashell""She sells seashells by the seashore."Training Method: The model was fine-tuned using LoRA (Low-Rank Adaptation) without quantization to maintain high precision and model quality.
Parameters:
The model was trained on tongue twisters, which are specific to a subset of the English language and may not capture cultural or linguistic diversity. The dataset could contain patterns reflective of Western language games, which might affect the diversity of the generated text.
The following versions were used during the inference of the model:
You can install these dependencies using the following command:
pip install transformers peft torch
You can use this model for inference using the Hugging Face transformers library:
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
# Load the model and tokenizer
model_name = "ec-kim/gemma2-tongue-twister-generator"
base_model = AutoModelForCausalLM.from_pretrained("google/gemma-2-2b-it")
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = PeftModel.from_pretrained(base_model, model_name)
# Generate tongue twister
question = "Generate tongue twisters about key words: cinnamon synonym"
inputs = tokenizer(question, return_tensors="pt")
outputs = model.generate(
inputs.input_ids,
max_length=100,
num_return_sequences=1,
no_repeat_ngram_size=2,
repetition_penalty=2.0,
top_k=50,
top_p=0.95,
temperature=0.7,
eos_token_id=tokenizer.eos_token_id,
do_sample=True
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
Prompt: "Generate tongue twisters about key words: weeping winnie"
Output: "Generate tongue twisters about key words: weeping winnie wore wimpier wings when she wanted to weep."
This model was fine-tuned by using the Hugging Face transformers and peft libraries. The training dataset is based on the paper "TongueTwister Games: A New Benchmark and Dataset for Word Play Generation" from ACL 2023. For any issues, please contact here