Downloads · 30 days
0
shielamms/tf-eurovision-txt-gen
tf-eurovision-txt-gen is a machine learning model from shielamms. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This is a text generation bi-directional LSTM model trained on a corpus of Eurovision song lyrics translated into English, preprocessed to 8,274 tokens (+OOV) and 172,249 n-gram sequences. Each embedding sequence inpu…
Downloads · 30 days
0
Access
Public
Updated Apr 25, 2023
Repo size
942 B
Likes
0
Public
Click a slice to open those files.
.json920 KB · 100%
From the Hugging Face model README
This is a text generation bi-directional LSTM model trained on a corpus of Eurovision song lyrics translated into English, preprocessed to 8,274 tokens (+OOV) and 172,249 n-gram sequences. Each embedding sequence input is a maximum of 202 tokens (pre-padded).
The model was built with Tensorflow 2.12.0.
The model was trained on the following dataset from Kaggle. https://www.kaggle.com/datasets/minitree/eurovision-song-lyrics
Use the tokenizer.json in this repo to convert your input text into sequences. The max length of a sequence is 202, while the model was trained on n-grams of each sequence as its features, the last token being the label. Thus, when testing the model, the maxlen parameter of pad_sequences has to be 201.
In Tensorflow:
seed_text = "Once when I was a child"
next_words = 10
for _ in range(next_words):
sequence = tokenizer.texts_to_sequences([seed_text])[0]
sequence = pad_sequences([sequence], maxlen=201, padding='pre')
prediction = model.predict(sequence, verbose=0)
prediction = np.argmax(prediction, axis=-1).item()
output = tokenizer.index_word[prediction]
seed_text += " " + output
print(seed_text)