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

pere
/
norwegian-gpt2

Text Generation
Transformers
PyTorch
JAX
TensorBoard
Norwegian
gpt2
norwegian
GPT2
casual language modeling
text-generation-inference
Model card Files Files and versions
xet
Metrics Training metrics Community
1

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

  • Libraries
  • Transformers

    How to use pere/norwegian-gpt2 with Transformers:

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

    How to use pere/norwegian-gpt2 with vLLM:

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

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

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

    docker model run hf.co/pere/norwegian-gpt2
norwegian-gpt2
1.02 GB
Ctrl+K
Ctrl+K
  • 2 contributors
History: 26 commits
elishowk's picture
elishowk
Automatic correction of README.md metadata. Contact website@huggingface.co for any question
be4f552 almost 5 years ago
  • .gitattributes
    737 Bytes
    test about 5 years ago
  • README.md
    333 Bytes
    Automatic correction of README.md metadata. Contact website@huggingface.co for any question almost 5 years ago
  • added_tokens.json
    24 Bytes
    first model about 5 years ago
  • config.json
    917 Bytes
    first model about 5 years ago
  • events.out.tfevents.1625180285.t1v-n-e90463ba-w-0.19511.3.v2
    626 kB
    xet
    test about 5 years ago
  • events.out.tfevents.1625204473.t1v-n-e90463ba-w-0.45312.3.v2
    626 kB
    xet
    test about 5 years ago
  • events.out.tfevents.1625210365.t1v-n-e90463ba-w-0.58898.3.v2
    11.5 MB
    xet
    Saving weights and logs of epoch 20 about 5 years ago
  • flax_model.msgpack
    498 MB
    xet
    Saving weights and logs of epoch 20 about 5 years ago
  • merges.txt
    503 kB
    first model about 5 years ago
  • pytorch_model.bin

    Detected Pickle imports (4)

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

    What is a pickle import?

    510 MB
    xet
    first model about 5 years ago
  • special_tokens_map.json
    90 Bytes
    first model about 5 years ago
  • tokenizer.json
    1.45 MB
    first model about 5 years ago
  • tokenizer_config.json
    220 Bytes
    first model about 5 years ago
  • vocab.json
    844 kB
    first model about 5 years ago