Instructions to use HamidRezaAttar/gpt2-product-description-generator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HamidRezaAttar/gpt2-product-description-generator with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HamidRezaAttar/gpt2-product-description-generator")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("HamidRezaAttar/gpt2-product-description-generator") model = AutoModelForCausalLM.from_pretrained("HamidRezaAttar/gpt2-product-description-generator") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use HamidRezaAttar/gpt2-product-description-generator with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HamidRezaAttar/gpt2-product-description-generator" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HamidRezaAttar/gpt2-product-description-generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HamidRezaAttar/gpt2-product-description-generator
- SGLang
How to use HamidRezaAttar/gpt2-product-description-generator with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "HamidRezaAttar/gpt2-product-description-generator" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HamidRezaAttar/gpt2-product-description-generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "HamidRezaAttar/gpt2-product-description-generator" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HamidRezaAttar/gpt2-product-description-generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HamidRezaAttar/gpt2-product-description-generator with Docker Model Runner:
docker model run hf.co/HamidRezaAttar/gpt2-product-description-generator
GPT2-Home
This model is fine-tuned using GPT-2 on amazon home products metadata. It can generate descriptions for your home products by getting a text prompt. https://github.com/HamidRezaAttar/GPT2-Home
Model description
GPT-2 is a large transformer-based language model with 1.5 billion parameters, trained on a dataset of 8 million web pages. GPT-2 is trained with a simple objective: predict the next word, given all of the previous words within some text. The diversity of the dataset causes this simple goal to contain naturally occurring demonstrations of many tasks across diverse domains. GPT-2 is a direct scale-up of GPT, with more than 10X the parameters and trained on more than 10X the amount of data.
Live Demo
For testing model with special configuration, please visit Demo
Blog Post
For more detailed information about project development please refer to my blog post.
How to use
For best experience and clean outputs, you can use Live Demo mentioned above, also you can use the notebook mentioned in my GitHub
You can use this model directly with a pipeline for text generation.
>>> from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
>>> tokenizer = AutoTokenizer.from_pretrained("HamidRezaAttar/gpt2-product-description-generator")
>>> model = AutoModelForCausalLM.from_pretrained("HamidRezaAttar/gpt2-product-description-generator")
>>> generator = pipeline('text-generation', model, tokenizer=tokenizer, config={'max_length':100})
>>> generated_text = generator("This bed is very comfortable.")
Citation info
@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}},
}
- Downloads last month
- 2,441