Make sure to check model page on Hugging Face
For testing model with special configuration, please visit Demo
For more detailed information about project development please refer to my blog post.
You can use this model directly with a pipeline for text generation:
pip install -U transformers
from transformers import pipeline
def remove_repetitions(text):
first_ocurrences = []
for sentence in text.split("."):
if sentence not in first_ocurrences:
first_ocurrences.append(sentence)
return '.'.join(first_ocurrences)
def trim_last_sentence(text):
return text[:text.rfind(".")+1]
def clean_txt(text):
return trim_last_sentence(remove_repetitions(text))
generator = pipeline('text-generation', 'HamidRezaAttar/gpt2-product-description-generator')
query = input("Please enter your text prompt: ")
generated_text = clean_txt(generator(query)[0]['generated_text'])
print(generated_text)
Notebook | |
---|---|
Test Outputs |
You can fine tune GPT-2 on any text-generation task using fastai library.
Notebook | |
---|---|
fine-tune GPT-2 |
@misc{GPT2-Home,
author = {HamidReza Fatollah Zadeh Attar},
title = {GPT2-Home the English home product description generator},
year = {2021},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/HamidRezaAttar/GPT2-Home}},
}
Image-based recommendations on styles and substitutes
J. McAuley, C. Targett, J. Shi, A. van den Hengel
SIGIR, 2015
Post a Github issue on the Issues repo.