Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Hardware
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

keshan
/
sinhala-gpt2

Text Generation
Transformers
PyTorch
google-tensorflow TensorFlow
JAX
TensorBoard
Sinhala
gpt2
feature-extraction
Sinhala
text-generation-inference
Model card Files Files and versions
xet
Metrics Training metrics Community
1

Instructions to use keshan/sinhala-gpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use keshan/sinhala-gpt2 with Transformers:

    # Use a pipeline as a high-level helper
    from transformers import pipeline
    
    pipe = pipeline("text-generation", model="keshan/sinhala-gpt2")
    # Load model directly
    from transformers import AutoTokenizer, AutoModel
    
    tokenizer = AutoTokenizer.from_pretrained("keshan/sinhala-gpt2")
    model = AutoModel.from_pretrained("keshan/sinhala-gpt2", device_map="auto")
  • Notebooks
  • Google Colab
  • Kaggle
  • Local Apps Settings
  • vLLM

    How to use keshan/sinhala-gpt2 with vLLM:

    Install from pip and serve model
    # Install vLLM from pip:
    pip install vllm
    # Start the vLLM server:
    vllm serve "keshan/sinhala-gpt2"
    # Call the server using curl (OpenAI-compatible API):
    curl -X POST "http://localhost:8000/v1/completions" \
    	-H "Content-Type: application/json" \
    	--data '{
    		"model": "keshan/sinhala-gpt2",
    		"prompt": "Once upon a time,",
    		"max_tokens": 512,
    		"temperature": 0.5
    	}'
    Use Docker
    docker model run hf.co/keshan/sinhala-gpt2
  • SGLang

    How to use keshan/sinhala-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 "keshan/sinhala-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": "keshan/sinhala-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 "keshan/sinhala-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": "keshan/sinhala-gpt2",
    		"prompt": "Once upon a time,",
    		"max_tokens": 512,
    		"temperature": 0.5
    	}'
  • Docker Model Runner

    How to use keshan/sinhala-gpt2 with Docker Model Runner:

    docker model run hf.co/keshan/sinhala-gpt2
sinhala-gpt2
1.52 GB
Ctrl+K
Ctrl+K
  • 1 contributor
History: 48 commits
keshan's picture
keshan
Update README.md
a3472be about 5 years ago
  • .gitattributes
    737 Bytes
    initial preps with config and tokenizers about 5 years ago
  • README.md
    839 Bytes
    Update README.md about 5 years ago
  • added_tokens.json
    24 Bytes
    adding pytorch model about 5 years ago
  • config.json
    868 Bytes
    adding pytorch model about 5 years ago
  • config.py
    194 Bytes
    Saving weights and logs of step 10 about 5 years ago
  • events.out.tfevents.1625851395.t1v-n-0b4afe6c-w-0.251724.3.v2
    40 Bytes
    xet
    Saving weights and logs of step 10 about 5 years ago
  • events.out.tfevents.1625851546.t1v-n-0b4afe6c-w-0.253683.3.v2
    14.3 MB
    xet
    adding pytorch model about 5 years ago
  • flax_model.msgpack
    498 MB
    xet
    Saving weights and logs of step 95000 about 5 years ago
  • merges.txt
    616 kB
    adding pytorch model about 5 years ago
  • pytorch_model.bin
    510 MB
    xet
    adding pytorch model about 5 years ago
  • si_tokenizer.py
    678 Bytes
    Saving weights and logs of step 10 about 5 years ago
  • special_tokens_map.json
    90 Bytes
    adding pytorch model about 5 years ago
  • tf_model.h5
    498 MB
    xet
    adding TF model about 5 years ago
  • tokenizer.json
    1.68 MB
    adding pytorch model about 5 years ago
  • tokenizer_config.json
    218 Bytes
    adding pytorch model about 5 years ago
  • vocab.json
    958 kB
    adding pytorch model about 5 years ago