safetensors llama license:mit region:us
---
license: mit
---

---
license: apache-2.0
license_link: https://www.apache.org/licenses/LICENSE-2.0
language:
- da
base_model: unsloth/llama-3-8b-bnb-4bit
tags:
- translation
- instruction-following
- danish
library_name: transformers
---

# Danish Model Primary Finetuned

## Introduction

**Danish Model Primary Finetuned** is an experimental research model designed to enhance Danish language understanding and translation capabilities. This model, derived from a LLaMA-based checkpoint with LoRA adaptations, showcases promising improvements in Danish translation tasks, as well as the ability to follow instructions and produce coherent Danish responses. While this is a fine-tuned release, there remain important caveats:

1. **Language Specificity**: Primarily tailored for Danish translation and instruction-following, performance may vary with English inputs or non-target languages.
2. **Contextual Challenges**: The model may occasionally produce content that should be carefully verified for accuracy, especially in specialized domains.
3. **Ethical and Safety Considerations**: Additional safety layers are advised, as outputs may need review before deployment in sensitive or production environments.
4. **Performance and Benchmark Limitations**: Although improved in handling Danish instructions and translations, there is room for enhancement in common sense reasoning, nuanced language understanding, and more complex tasks.

**Specification**:
- Type: Causal Language Model
- Training Stage: Pretraining & Post-training (LoRA fine-tuning)
- Architecture: LLaMA-based with 4-bit quantization, RoPE, SwiGLU, RMSNorm, and efficient attention mechanisms
- Context Length: Up to 2,048 tokens (depending on tokenizer and architecture)
- Base Model: [unsloth/llama-3-8b-bnb-4bit](https://huggingface.co/unsloth/llama-3-8b-bnb-4bit)

For more details on LoRA and other involved techniques, refer to the associated documentation, tutorials, and the base model's README.

## Requirements

This model relies on the latest versions of the Hugging Face `transformers` library and related dependencies. Using outdated versions may result in compatibility issues or decreased performance.

**Recommended Setup**:
- `transformers` ≥ 4.37.0
- `torch` (with CUDA support for GPU acceleration)
- `bitsandbytes`, `accelerate`, `peft`, `trl`, and `unsloth` for specialized loading and inference

## Quickstart

Below is a sample snippet illustrating how to load this model and generate responses, following a prompt-based instruction format that the model was trained on.

```python
import torch
from transformers import pipeline
from unsloth import FastLanguageModel

model_name = "KeerthiSaiKasaraneni/danish_model_primary_finetuned_model"

# Load model and tokenizer
model, tokenizer = FastLanguageModel.from_pretrained(
    model_name=model_name,
    load_in_4bit=True,
    dtype=torch.float16
)
FastLanguageModel.for_inference(model)

# Create a text generation pipeline
generation_pipeline = pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    device_map="auto"
)

# Example instruction
instruction = "Translate the following sentence into Danish."
user_input = "What is the capital of Denmark?"
prompt = f"Instruction: {instruction} Input: {user_input} Output:"

generated = generation_pipeline(prompt, max_length=128, num_return_sequences=1)
response = generated[0]['generated_text']
print(response)

```




## Citation

If you find our work helpful, feel free to give us a cite.

```
@misc{danish_model_primary_finetuned,
    title = {Danish Model Primary Finetuned},
    url = {https://huggingface.co/KeerthiSaiKasaraneni/danish_model_primary_finetuned_model},
    author = {[Author/Team Name]},
    month = {December},
    year = {2024}
}
```








