File size: 1,735 Bytes
98b3867
 
94683b4
 
 
 
 
 
cce71f6
98b3867
 
e569165
 
 
 
98b3867
 
 
 
 
 
 
 
 
bc94dee
98b3867
 
 
 
cce71f6
98b3867
 
 
 
 
 
 
 
cce71f6
 
 
98b3867
cce71f6
 
98b3867
cce71f6
 
 
 
 
 
98b3867
cce71f6
 
 
 
 
 
98b3867
cce71f6
 
 
98b3867
cce71f6
 
 
 
98b3867
cce71f6
 
 
 
 
 
 
 
98b3867
cce71f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
library_name: transformers
tags:
- code
datasets:
- Replete-AI/code_bagel
language:
- en
license: llama3
---

# Model Card for Llama 3 8B SFT Code Bagel


![image/png](https://cdn-uploads.huggingface.co/production/uploads/6324ce4d5d0cf5c62c6e3c5a/XWUE404ZzKZmvQY6ojAHk.png)

<!-- Provide a quick summary of what the model is/does. -->



## Model Details

### Model Description

This model, Llama3-8B-SFT-code_bagel-bnb-4bit, is a fine-tuned version of the Meta-Llama-3-8B-Instruct model, finetuned via SFT on 35k randomly selected rows from the Replete-AI/code_bagel dataset using Supervised Fine-Tuning (SFT) and quantized to 4-bit precision using the Bits and Bytes (bnb) library. It is optimized for code-related tasks.


## Uses

Coding and code related tasks


## How to Get Started with the Model

Use the code below to get started with the model.

[More Information Needed]

```python
import torch
import transformers

# Load the tokenizer and model
model_id = "thesven/Llama3-8B-SFT-code_bagel-bnb-4bit"

pipeline = transformers.pipeline(
    "text-generation",
    model=model_id,
    model_kwargs={"torch_dtype": torch.bfloat16},
    device_map="auto",
)

messages = [
    {
        "role": "user",
        "content": "Write me a python function to turn every other letter in a string to uppercase?",
    },
]

prompt = pipeline.tokenizer.apply_chat_template(
    messages, tokenize=False, add_generation_prompt=True
)

terminators = [
    pipeline.tokenizer.eos_token_id,
    pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>"),
]

outputs = pipeline(
    prompt,
    max_new_tokens=256,
    eos_token_id=terminators,
    do_sample=True,
    temperature=0.1,
)
print(outputs[0]["generated_text"][len(prompt) :])

```