Instructions to use AI-Sweden-Models/gpt-sw3-40b-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use AI-Sweden-Models/gpt-sw3-40b-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="AI-Sweden-Models/gpt-sw3-40b-gguf", filename="gpt-sw3-40b-Q4_K_M.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use AI-Sweden-Models/gpt-sw3-40b-gguf with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M
Use Docker
docker model run hf.co/AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use AI-Sweden-Models/gpt-sw3-40b-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AI-Sweden-Models/gpt-sw3-40b-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AI-Sweden-Models/gpt-sw3-40b-gguf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M
- Ollama
How to use AI-Sweden-Models/gpt-sw3-40b-gguf with Ollama:
ollama run hf.co/AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M
- Unsloth Studio
How to use AI-Sweden-Models/gpt-sw3-40b-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for AI-Sweden-Models/gpt-sw3-40b-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for AI-Sweden-Models/gpt-sw3-40b-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for AI-Sweden-Models/gpt-sw3-40b-gguf to start chatting
- Atomic Chat new
- Docker Model Runner
How to use AI-Sweden-Models/gpt-sw3-40b-gguf with Docker Model Runner:
docker model run hf.co/AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M
- Lemonade
How to use AI-Sweden-Models/gpt-sw3-40b-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull AI-Sweden-Models/gpt-sw3-40b-gguf:Q4_K_M
Run and chat with the model
lemonade run user.gpt-sw3-40b-gguf-Q4_K_M
List all available models
lemonade list
You need to agree to share your contact information to access this model
We process new request once a week.
No requests will be processed during week 28-33.
To access the model you need to belong to an European university or research organization
AND have a valid email adress correlating to the university or research organization you belong to.
You agree to use the model for research purposes only.
To read more visit
https://www.ai.se/en/project/gpt-sw3.
Log in or Sign Up to review the conditions and access this model content.
Model description
AI Sweden
Base models
GPT-Sw3 126M | GPT-Sw3 356M | GPT-Sw3 1.3B
GPT-Sw3 6.7B | GPT-Sw3 6.7B v2 | GPT-Sw3 20B
GPT-Sw3 40B
Instruct models
GPT-Sw3 126M Instruct | GPT-Sw3 356M Instruct | GPT-Sw3 1.3B Instruct
GPT-Sw3 6.7B v2 Instruct | GPT-Sw3 20B Instruct
Quantized models
GPT-Sw3 6.7B v2 Instruct 4-bit gptq | GPT-Sw3 20B Instruct 4-bit gptq
GPT-SW3 is a collection of large decoder-only pretrained transformer language models that were developed by AI Sweden in collaboration with RISE and the WASP WARA for Media and Language. GPT-SW3 has been trained on a dataset containing 320B tokens in Swedish, Norwegian, Danish, Icelandic, English, and programming code. The model was pretrained using a causal language modeling (CLM) objective utilizing the NeMo Megatron GPT implementation.
Intended use
GPT-SW3 is an autoregressive large language model that is capable of generating coherent text in 5 different languages, and 4 programming languages. GPT-SW3 can also be instructed to perform text tasks that it has not been explicitly trained for, by casting them as text generation tasks.
Limitations
Like other large language models for which the diversity (or lack thereof) of training data induces downstream impact on the quality of our model, GPT-SW3 has limitations in terms of for example bias and safety. GPT-SW3 can also have quality issues in terms of generation diversity and hallucination. By releasing with the modified RAIL license, we also hope to increase communication, transparency, and the study of large language models. The model may: overrepresent some viewpoints and underrepresent others, contain stereotypes, generate hateful, abusive, violent, discriminatory or prejudicial language. The model may make errors, including producing incorrect information as if it were factual, it may generate irrelevant or repetitive outputs, and content that may not be appropriate for all settings, including sexual content.
How to use
To be able to access the model from Python, since this is a private repository, you have to log in with your access token. This can be done with huggingface-cli login, see HuggingFace Quick Start Guide for more information.
The following code snippet loads our tokenizer & model, and uses the GPU if available.
import torch
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
# Initialize Variables
model_name = "AI-Sweden-Models/gpt-sw3-126m"
device = "cuda:0" if torch.cuda.is_available() else "cpu"
prompt = "Träd är fina för att"
# Initialize Tokenizer & Model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
model.eval()
model.to(device)
Generating text using the generate method is done as follows:
input_ids = tokenizer(prompt, return_tensors="pt")["input_ids"].to(device)
generated_token_ids = model.generate(
inputs=input_ids,
max_new_tokens=100,
do_sample=True,
temperature=0.6,
top_p=1,
)[0]
generated_text = tokenizer.decode(generated_token_ids)
A convenient alternative to the generate method is the HuggingFace pipeline, which handles most of the work for you:
generator = pipeline('text-generation', tokenizer=tokenizer, model=model, device=device)
generated = generator(prompt, max_new_tokens=100, do_sample=True, temperature=0.6, top_p=1)[0]["generated_text"]
Maintenance
- Who is supporting/hosting/maintaining the dataset? AI Sweden at Lindholmen Science Park AB.
- How can the owner/curator/manager of the dataset be contacted (e.g., email address)? nlu@ai.se
- Is there an erratum? If so, please provide a link or other access point. N/A.
- Will the dataset be updated (e.g., to correct labeling errors, add new instances, delete instances)? If so, please describe how often, by whom, and how updates will be communicated to users (e.g., mailing list, GitHub)? Currently, there are no plans for updating the dataset.
- If the dataset relates to people, are there applicable limits on the retention of the data associated with the instances (e.g., were individuals in question told that their data would be retained for a fixed period of time and then deleted)? If so, please describe these limits and explain how they will be enforced. Read the privacy policy for the NLU initiative at AI Sweden here.
- Will older versions of the dataset continue to be supported/hosted/maintained? If so, please describe how. If not, please describe how its obsolescence will be communicated to users. N/A.
- If others want to extend/augment/build on/contribute to the dataset, is there a mechanism for them to do so? If so, please provide a description. Will these contributions be validated/ verified? If so, please describe how. If not, why not? Is there a process for communicating/ distributing these contributions to other users? If so, please provide a description. Not at this time.
- Any other comments? No.
- Downloads last month
- -
4-bit
5-bit