Text Generation
Transformers
PyTorch
TensorFlow
JAX
LiteRT
Rust
ONNX
Safetensors
English
gpt2
exbert
text-generation-inference
Instructions to use openai-community/gpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openai-community/gpt2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openai-community/gpt2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2") model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use openai-community/gpt2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openai-community/gpt2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openai-community/gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/openai-community/gpt2
- SGLang
How to use openai-community/gpt2 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 "openai-community/gpt2" \ --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": "openai-community/gpt2", "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 "openai-community/gpt2" \ --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": "openai-community/gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use openai-community/gpt2 with Docker Model Runner:
docker model run hf.co/openai-community/gpt2
Create prompt
#110
by stopkid4 - opened
prompt
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Create a chatbot to help guide users in selecting the best career track based on their skills and interests. The chatbot should ask the following questions to understand the user's background and preferences:
|
| 2 |
+
|
| 3 |
+
What is your current level of experience in programming or IT? (Beginner, Intermediate, Advanced)
|
| 4 |
+
What areas of technology interest you the most? (e.g., Cloud Computing, Backend Development, DevOps, Data Engineering, etc.)
|
| 5 |
+
Do you prefer working on the front end (user interface) or back end (server-side) of applications?
|
| 6 |
+
Are you interested in data-related fields, such as data engineering, data analytics, or databases?
|
| 7 |
+
How comfortable are you with modern JavaScript frameworks like React?
|
| 8 |
+
Are you interested in learning about cloud computing and its applications?
|
| 9 |
+
Do you have any experience with or interest in artificial intelligence and machine learning?
|
| 10 |
+
How important is system design and architecture in your career goals?
|
| 11 |
+
Are you interested in learning about DevOps practices and tools?
|
| 12 |
+
Do you prefer working with Python for data-related tasks?
|
| 13 |
+
Based on the user's responses, the chatbot will suggest one of the following Learning Paths:
|
| 14 |
+
|
| 15 |
+
AWS 1: Intro to Cloud Computing
|
| 16 |
+
Backend Engineering with NodeJS
|
| 17 |
+
DevOps
|
| 18 |
+
Data Engineering
|
| 19 |
+
Databases
|
| 20 |
+
Frontend Engineering with React
|
| 21 |
+
Intro to Gen AI & Prompt Engineering
|
| 22 |
+
System Design and Architecture
|
| 23 |
+
Modern JavaScript
|
| 24 |
+
Data Analytics using Python
|
| 25 |
+
Ensure the chatbot provides a brief explanation of why the suggested Learning Path is a good fit for the user, considering their skills and interests.
|
| 26 |
+
After determining the track, ask them to take the course using this link: https://bit.ly/talentsarenajs
|