Text Generation
Transformers
PyTorch
TensorFlow
Safetensors
Turkish
gpt2
Turkish
turkish
text-generation-inference
Instructions to use ytu-ce-cosmos/turkish-gpt2-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ytu-ce-cosmos/turkish-gpt2-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ytu-ce-cosmos/turkish-gpt2-large")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("ytu-ce-cosmos/turkish-gpt2-large") model = AutoModelForMultimodalLM.from_pretrained("ytu-ce-cosmos/turkish-gpt2-large") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ytu-ce-cosmos/turkish-gpt2-large with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ytu-ce-cosmos/turkish-gpt2-large" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ytu-ce-cosmos/turkish-gpt2-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ytu-ce-cosmos/turkish-gpt2-large
- SGLang
How to use ytu-ce-cosmos/turkish-gpt2-large 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 "ytu-ce-cosmos/turkish-gpt2-large" \ --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": "ytu-ce-cosmos/turkish-gpt2-large", "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 "ytu-ce-cosmos/turkish-gpt2-large" \ --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": "ytu-ce-cosmos/turkish-gpt2-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ytu-ce-cosmos/turkish-gpt2-large with Docker Model Runner:
docker model run hf.co/ytu-ce-cosmos/turkish-gpt2-large
File size: 1,509 Bytes
d2ec1e8 f3c76f3 d2ec1e8 f3c76f3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ---
license: mit
datasets:
- uonlp/CulturaX
language:
- tr
pipeline_tag: text-generation
tags:
- Turkish
- turkish
- gpt2
---
# turkish-gpt2
This is a Turkish GPT-2 large model. GPT-2 is designed for text generation tasks, providing the ability to continue a given text snippet in a coherent and contextually relevant manner.
Due to the diverse nature of the training data, which includes websites, books, and other text sources, this model can exhibit biases. Users should be aware of these biases and use the model responsibly.
## Example Usage
```python
from transformers import AutoTokenizer, GPT2LMHeadModel
from transformers import pipeline
model = GPT2LMHeadModel.from_pretrained("ytu-ce-cosmos/turkish-gpt2-large")
tokenizer = AutoTokenizer.from_pretrained("ytu-ce-cosmos/turkish-gpt2-large")
text_generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
r = text_generator("Teknolojinin gelişimi hayatımızı önemli ölçüde etkiledi. ", max_length=100)
[{'generated_text': 'Teknolojinin gelişimi hayatımızı önemli ölçüde etkiledi. "Sosyal ağ" adını verdiğimiz yeni bir iletişim çağımız oluştu. '}]
```
# Acknowledgments
- Research supported with Cloud TPUs from [Google's TensorFlow Research Cloud](https://sites.research.google/trc/about/) (TFRC). Thanks for providing access to the TFRC ❤️
- Thanks to the generous support from the Hugging Face team, it is possible to download models from their S3 storage 🤗
# Citation
Paper coming soon 😊 |