Instructions to use ahmet1338/gpt-2-experimental with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ahmet1338/gpt-2-experimental with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ahmet1338/gpt-2-experimental")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ahmet1338/gpt-2-experimental") model = AutoModelForCausalLM.from_pretrained("ahmet1338/gpt-2-experimental") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ahmet1338/gpt-2-experimental with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ahmet1338/gpt-2-experimental" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ahmet1338/gpt-2-experimental", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ahmet1338/gpt-2-experimental
- SGLang
How to use ahmet1338/gpt-2-experimental 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 "ahmet1338/gpt-2-experimental" \ --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": "ahmet1338/gpt-2-experimental", "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 "ahmet1338/gpt-2-experimental" \ --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": "ahmet1338/gpt-2-experimental", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ahmet1338/gpt-2-experimental with Docker Model Runner:
docker model run hf.co/ahmet1338/gpt-2-experimental
Turkish GPT-2 Model (Experimental)
I've made available a GPT-2 model for Turkish that I trained on a variety of texts.
The model is intended to serve as a starting point for text-specific adjustments.
Training Source
I used a Turkish corpus that is taken from different written and oral sources.
I developed a LLM model with 50k vocabulary using the Custom Tokenizers library using the training resources.
I could train the GPT-2 for Turkish using the entire training corpus (ten epochs) after developing the vocabulary.
Using the model
The model itself can be used in this way:
from transformers import AutoTokenizer, AutoModelWithLMHead
tokenizer = AutoTokenizer.from_pretrained("ahmet1338/gpt-2-experimental")
model = AutoModelWithLMHead.from_pretrained("ahmet1338/gpt-2-experimental")
To generating text, we can use these lines of code which is Transformers Pipelines:
from transformers import pipeline
pipe = pipeline('text-generation', model="ahmet1338/gpt-2-experimental",
tokenizer="ahmet1338/gpt-2-experimental", config={'max_length':800})
text = pipe("Akşamüstü yolda ilerlerken, ")[0]["generated_text"]
print(text)
How to clone the model repo?
git lfs install
git clone https://huggingface.co/ahmet1338/gpt-2-experimential
- Downloads last month
- 21