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

Finnish-NLP
/
gpt2-large-finnish

Text Generation
Transformers
PyTorch
JAX
TensorBoard
Finnish
gpt2
finnish
text-generation-inference
Model card Files Files and versions
xet
Metrics Training metrics Community
5

Instructions to use Finnish-NLP/gpt2-large-finnish with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use Finnish-NLP/gpt2-large-finnish with Transformers:

    # Use a pipeline as a high-level helper
    from transformers import pipeline
    
    pipe = pipeline("text-generation", model="Finnish-NLP/gpt2-large-finnish")
    # pip install -U transformers accelerate
    # Load model directly
    from transformers import AutoTokenizer, AutoModelForCausalLM
    
    tokenizer = AutoTokenizer.from_pretrained("Finnish-NLP/gpt2-large-finnish")
    model = AutoModelForCausalLM.from_pretrained("Finnish-NLP/gpt2-large-finnish", device_map="auto")
  • Notebooks
  • Google Colab
  • Kaggle
  • Local Apps Settings
  • vLLM

    How to use Finnish-NLP/gpt2-large-finnish with vLLM:

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

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

    How to use Finnish-NLP/gpt2-large-finnish with Docker Model Runner:

    docker model run hf.co/Finnish-NLP/gpt2-large-finnish
gpt2-large-finnish
6.33 GB
Ctrl+K
Ctrl+K
  • 2 contributors
History: 111 commits
aapot's picture
aapot
Update README.md
d22c61d over 4 years ago
  • runs
    Revert to 640k train step over 4 years ago
  • .gitattributes
    1.18 kB
    initial commit over 4 years ago
  • README.md
    7.41 kB
    Update README.md over 4 years ago
  • added_tokens.json
    24 Bytes
    Try fix git over 4 years ago
  • config.json
    912 Bytes
    Increase default max length over 4 years ago
  • flax_model.msgpack
    3.1 GB
    xet
    Revert to 640k train step over 4 years ago
  • flax_model_to_pytorch.py
    799 Bytes
    Try fix git over 4 years ago
  • merges.txt
    532 kB
    Try fix git over 4 years ago
  • pytorch_model.bin

    Detected Pickle imports (4)

    • "torch.FloatStorage",
    • "torch._utils._rebuild_tensor_v2",
    • "torch.ByteStorage",
    • "collections.OrderedDict"

    What is a pickle import?

    3.13 GB
    xet
    Revert to 640k train step over 4 years ago
  • replace_token_script.py
    2.93 kB
    Try fix git over 4 years ago
  • run_clm_flax.py
    39.6 kB
    Try fix git over 4 years ago
  • special_tokens_map.json
    120 Bytes
    Try fix git over 4 years ago
  • start_train.sh
    884 Bytes
    Remove git trial run model over 4 years ago
  • tokenizer.json
    2.26 MB
    Try fix git over 4 years ago
  • tokenizer_config.json
    208 Bytes
    Try fix git over 4 years ago
  • train_tokenizer.py
    835 Bytes
    Try fix git over 4 years ago
  • vocab.json
    873 kB
    Try fix git over 4 years ago