Instructions to use Ochiroo/tiny_mn_gpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ochiroo/tiny_mn_gpt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ochiroo/tiny_mn_gpt")# Load model directly from transformers import AutoTokenizer, TF_AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Ochiroo/tiny_mn_gpt") model = TF_AutoModelForCausalLM.from_pretrained("Ochiroo/tiny_mn_gpt") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Ochiroo/tiny_mn_gpt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ochiroo/tiny_mn_gpt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ochiroo/tiny_mn_gpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Ochiroo/tiny_mn_gpt
- SGLang
How to use Ochiroo/tiny_mn_gpt 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 "Ochiroo/tiny_mn_gpt" \ --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": "Ochiroo/tiny_mn_gpt", "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 "Ochiroo/tiny_mn_gpt" \ --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": "Ochiroo/tiny_mn_gpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Ochiroo/tiny_mn_gpt with Docker Model Runner:
docker model run hf.co/Ochiroo/tiny_mn_gpt
# Load model directly
from transformers import AutoTokenizer, TF_AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Ochiroo/tiny_mn_gpt")
model = TF_AutoModelForCausalLM.from_pretrained("Ochiroo/tiny_mn_gpt")Quick Links
GPT2-Mongolia
Model description
GPT-2 is a transformers model pretrained on a very small corpus of Mongolian news data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it was trained to guess the next word in sentences.
How to use
import tensorflow as tf
from transformers import GPT2Config, TFGPT2LMHeadModel, GPT2Tokenizer
from transformers import WEIGHTS_NAME, CONFIG_NAME
tokenizer = GPT2Tokenizer.from_pretrained('Ochiroo/tiny_mn_gpt')
model = TFGPT2LMHeadModel.from_pretrained('Ochiroo/tiny_mn_gpt')
text = "Намайг Эрдэнэ-Очир гэдэг. Би"
input_ids = tokenizer.encode(text, return_tensors='tf')
beam_outputs = model.generate(
input_ids,
max_length = 25,
num_beams = 5,
temperature = 0.7,
no_repeat_ngram_size=2,
num_return_sequences=5
)
print(tokenizer.decode(beam_outputs[0]))
Training data and biases
Trained on 500MB of Mongolian news dataset (IKON) on RTX 2060.
- Downloads last month
- 6
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ochiroo/tiny_mn_gpt")