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
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

valhalla
/
gpt2-norwegian

Text Generation
Transformers
JAX
TensorBoard
gpt2
Model card Files Files and versions
xet
Metrics Training metrics Community

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

  • Libraries
  • Transformers

    How to use valhalla/gpt2-norwegian with Transformers:

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

    How to use valhalla/gpt2-norwegian with vLLM:

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

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

    How to use valhalla/gpt2-norwegian with Docker Model Runner:

    docker model run hf.co/valhalla/gpt2-norwegian
gpt2-norwegian
512 MB
Ctrl+K
Ctrl+K
  • 1 contributor
History: 5 commits
valhalla's picture
valhalla
add model
58c0158 almost 5 years ago
  • .gitattributes
    730 Bytes
    Update .gitattributes almost 5 years ago
  • config.json
    689 Bytes
    add model almost 5 years ago
  • events.out.tfevents.1623422138.t1v-n-605115f1-w-0.3840.3.v2
    40 Bytes
    xet
    add model almost 5 years ago
  • events.out.tfevents.1623422271.t1v-n-605115f1-w-0.5259.3.v2
    40 Bytes
    xet
    add model almost 5 years ago
  • events.out.tfevents.1623422427.t1v-n-605115f1-w-0.6700.3.v2
    40 Bytes
    xet
    add model almost 5 years ago
  • events.out.tfevents.1623425594.t1v-n-605115f1-w-0.8119.3.v2
    1.75 MB
    xet
    add model almost 5 years ago
  • events.out.tfevents.1623440802.t1v-n-605115f1-w-0.10569.3.v2
    11.5 MB
    xet
    add model almost 5 years ago
  • flax_model.msgpack
    496 MB
    xet
    add model almost 5 years ago
  • merges.txt
    503 kB
    add model almost 5 years ago
  • special_tokens_map.json
    239 Bytes
    add model almost 5 years ago
  • tokenizer.json
    1.45 MB
    add model almost 5 years ago
  • tokenizer_config.json
    252 Bytes
    add model almost 5 years ago
  • vocab.json
    844 kB
    add model almost 5 years ago