You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _pages/dat450/assignment4.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ In this assignment, you will perform supervised fine-tuning (SFT) of a small ope
21
21
22
22
Please submit your solution [in Canvas](https://canvas.chalmers.se/courses/36909/assignments/117618). **Submission deadline: December 1**.
23
23
24
-
Submit Python files containing your solution to the programming tasks described below. In addition, to save time for the people who grade your submission, please submit a text file containing the outputs printed out by your Python program; read the instructions carefully so that the right outputs are included. (Most important outputs already designed for the code)
24
+
Submit Python files containing your solution to the programming tasks described below. In addition, to save time for the people who grade your submission, please submit a text file containing the outputs printed out by your Python program; read the instructions carefully so that the right outputs are included. The most important outputs are already designed for the code.
25
25
26
26
This is a pure programming assignment and you do not have to write a technical report or explain details of your solution: there will be a separate individual assignment where you will answer some conceptual questions about what you have been doing here.
27
27
@@ -35,7 +35,7 @@ This assignment is adapted from a previous version by Marco Kuhlmann and updated
35
35
36
36
### Libraries
37
37
38
-
As in the previous assignment, you can use the pre-set environment `source /data/courses/2025_dat450_dit247/venvs/dat450_venv/bin/activate`.
38
+
As in the previous assignments, you can use the pre-set environment `source /data/courses/2025_dat450_dit247/venvs/dat450_venv/bin/activate`.
39
39
40
40
Alternatively, if you are working on your own machine or some cloud-based service, install the following libraries with a package manager such as `pip` or `uv`:
@@ -47,7 +47,7 @@ Alternatively, if you are working on your own machine or some cloud-based servic
47
47
48
48
### Getting the files
49
49
50
-
The dataset [Alpaca](https://huggingface.co/datasets/tatsu-lab/alpaca) is a collection of 52k instruction-response pairs designed for SFT of LLM for instruction following (JSON format). For easy use we already downloaed this dataset that you can load using the HF datasets as:
50
+
The dataset [Alpaca](https://huggingface.co/datasets/tatsu-lab/alpaca) is a collection of 52k instruction-response pairs designed for SFT of LLM for instruction following (JSON format). You can load using the HF datasets as:
51
51
52
52
```python
53
53
from datasets import load_dataset
@@ -84,9 +84,7 @@ To get a clear idea of how to complete the assignment, you can start with the sk
84
84
└── utils.py
85
85
```
86
86
87
-
In short, you need to fill in the incomplete parts of `data_utils.py` and `lora.py`. The other files contain helpful functions to run the assignment, but it’s highly recommended to review the documented code to understand the structure of the project. To ensure your code works correctly, you can follow these instructions and run the code either:
88
-
89
-
Using the prebuilt environment:
87
+
In short, you need to fill in the incomplete parts of `data_utils.py` and `lora.py`. The other files contain helpful functions to run the assignment. It’s highly recommended to review the documented code to understand the structure of the project. To ensure your code works correctly, you can follow these instructions and run the code using the pre-built environment:
90
88
```bash
91
89
python3 main.py
92
90
```
@@ -114,7 +112,7 @@ DatasetDict({
114
112
</div>
115
113
</details>
116
114
117
-
Then we need to create our training and testing sets from that dataset. To do this, we use two methods provided by HF datasets, [`select`](https://huggingface.co/docs/datasets/v1.8.0/package_reference/main_classes.html#datasets.Dataset.select) and [`train_test_split`](https://huggingface.co/docs/datasets/v1.8.0/package_reference/main_classes.html#datasets.Dataset.train_test_split), which help us choose the subsets as training and testing data. Although that's a cleaned version of Alpaca, to ensure we always have output, we filter out all rows where the output is empty. To achieve an equal distribution of different instructions corresponding to the inputs, we also stratify the rows based on the presence or absence of input.
115
+
Then we need to create our training and testing sets from that dataset. To do this, we use two methods provided by HF datasets, [`select`](https://huggingface.co/docs/datasets/v1.8.0/package_reference/main_classes.html#datasets.Dataset.select) and [`train_test_split`](https://huggingface.co/docs/datasets/v1.8.0/package_reference/main_classes.html#datasets.Dataset.train_test_split), which help us choose the subsets as training and testing data. Although we provide a cleaned version of Alpaca, we need to filter out all rows where the output is empty to ensure we always have output. To achieve an equal distribution of different instructions corresponding to the inputs, we also stratify the rows based on the presence or absence of input.
0 commit comments