Run this model with HF Jobs
Run mhenrichsen/danskgpt-tiny-chat on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/mhenrichsen/danskgpt-tiny-chat. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/mhenrichsen/danskgpt-tiny-chat on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/mhenrichsen/danskgpt-tiny-chat. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/mhenrichsen/danskgpt-tiny-chat. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use mhenrichsen/danskgpt-tiny-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mhenrichsen/danskgpt-tiny-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mhenrichsen/danskgpt-tiny-chat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mhenrichsen/danskgpt-tiny-chat") model = AutoModelForCausalLM.from_pretrained("mhenrichsen/danskgpt-tiny-chat", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mhenrichsen/danskgpt-tiny-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mhenrichsen/danskgpt-tiny-chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mhenrichsen/danskgpt-tiny-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mhenrichsen/danskgpt-tiny-chat
- SGLang
How to use mhenrichsen/danskgpt-tiny-chat 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 "mhenrichsen/danskgpt-tiny-chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mhenrichsen/danskgpt-tiny-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "mhenrichsen/danskgpt-tiny-chat" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mhenrichsen/danskgpt-tiny-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mhenrichsen/danskgpt-tiny-chat with Docker Model Runner:
docker model run hf.co/mhenrichsen/danskgpt-tiny-chat
DanskGPT-tiny-chat
DanskGPT-tiny-chat er chat-varianten af mhenrichsen/danskgpt-tiny trænet på private chat datasæt.
Model beskrivelse
Modellen er beregnet til at være en lightweight version af DanskGPT, der kan køre på næsten alle enheder.
Prompt template
Modellen er trænet med ChatML format (samme som OpenAI's modeller), og skal bruges på følgende måde:
<|im_start|>system\nDu er en hjælpsom assistent.<|im_end|>\n<|im_start|>user\nHvad er skak?<|im_end|>\n<|im_start|>assistant
Inferens
Ollama
Installér ollama: https://ollama.ai/download
Kør:
ollama run mhenrichsen/danskgpt-tiny-chat
vLLM
pip install vllm
from vllm import LLM, SamplingParams
sampling_params = SamplingParams(temperature=0.8, top_p=0.95, max_tokens=1024)
llm = LLM(model="mhenrichsen/danskgpt-tiny-chat")
system_message = "Du er en hjælpsom assistent."
conversation_history = f"<|im_start|>system\n{system_message}<|im_end|>\n<|im_start|>user\n"
while True:
prompt = input("Bruger: ")
new_prompt = f"{conversation_history}{prompt}<|im_end|>\n<|im_start|>assistant\n"
outputs = llm.generate(new_prompt, sampling_params)
for output in outputs:
prompt = output.prompt
generated_text = output.outputs[0].text
print(f"AI: {generated_text!r}")
conversation_history = f"{prompt}{generated_text!r}<|im_end|>\n<|im_start|>user\n"
Endpoint med openai
pip install openai
python -m vllm.entrypoints.openai.api_server --model mhenrichsen/danskgpt-tiny-chat
og brugt som erstatning for OpenAI's endpoints:
from openai import OpenAI
openai_api_key = "EMPTY"
openai_api_base = "http://localhost:8000/v1"
client = OpenAI(
api_key=openai_api_key,
base_url=openai_api_base,
)
chat_response = client.chat.completions.create(
model="mhenrichsen/danskgpt-tiny-chat",
messages=[
{"role": "system", "content": "Du er en hjælpsom assistent. Giv mig et langt svar."},
{"role": "user", "content": "Fortæl mig om Danmark."},
]
)
print("AI:", chat_response)
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 1.3599 | 0.0 | 1 | 1.4118 |
| 0.7896 | 0.25 | 136 | 0.7813 |
| 0.7339 | 0.5 | 272 | 0.7490 |
| 0.7378 | 0.75 | 408 | 0.7285 |
| 0.7112 | 1.0 | 544 | 0.7146 |
| 0.6377 | 1.23 | 680 | 0.7135 |
| 0.6192 | 1.49 | 816 | 0.7133 |
| 0.5985 | 1.74 | 952 | 0.7073 |
| 0.6067 | 1.99 | 1088 | 0.7026 |
| 0.5139 | 2.22 | 1224 | 0.7167 |
| 0.5099 | 2.47 | 1360 | 0.7193 |
| 0.5217 | 2.72 | 1496 | 0.7168 |
Brug for hjælp?
Har du spørgsmål eller brug for hjælp til LLM'er eller automatisering af tekstbaserede opgaver, så kontakt mig gerne.
/Mads
- Downloads last month
- 166