# Publish the notebook project and link each article

No GitHub repository has been created or pushed by this download. Use the account and repository you choose. Your previously supplied profile was `abolfazlseyedjavadein`; the website's existing configured remote used a different owner, so do not assume they are interchangeable.

## 1. Keep the structure

Extract `codetips-fine-tuning-lab`. Open that folder. It contains `ft_lab.py`, `notebooks/`, `articles/`, `assets/`, `scripts/`, and this guide. Upload the contents of this folder as the repository root. Do not upload just the ZIP or the ten notebooks without their support files.

## 2. Create a repository

On GitHub, create a new repository such as `fine-tuning-methods-lab`. Choose public if visitors should access it without signing in. You can upload the files through GitHub's Add file → Upload files, preserving the folders. A local Git workflow is more convenient for later updates.

From a terminal in the extracted project folder, after creating an empty remote repository:

```powershell
git init
git add .
git commit -m "Add beginner fine-tuning articles and executed notebooks"
git branch -M main
git remote add origin https://github.com/OWNER/fine-tuning-methods-lab.git
git push -u origin main
```

Replace OWNER with the actual account. These commands are instructions for your new notebook repository, not for the existing ASP.NET website repository. Do not paste access tokens into files or notebooks. Local checkpoint/model folders are ignored.

## 3. Choose a stable version

For links that follow updates, use `main`. For article reproducibility, use an immutable commit SHA or publish a release tag such as `v1.0.0`. On GitHub, open a notebook file and copy its browser URL. The shape is:

```text
https://github.com/OWNER/REPOSITORY/blob/main/notebooks/05-lora-from-scratch.ipynb
https://github.com/OWNER/REPOSITORY/blob/v1.0.0/notebooks/05-lora-from-scratch.ipynb
```

Use `/blob/` for a file preview, not `/tree/`. A raw-file URL is mainly for downloading; it is not the normal readable notebook page.

## 4. Generate all ten links

Run this command from the project root with the repository you actually published:

```powershell
python tools/github_links.py --repo OWNER/REPOSITORY --ref main
```

It prints exact links and ready-to-paste HTML. It does not call GitHub, change article content, or push files. Verify at least one generated URL in a signed-out/private browser before publishing links. A private repository will require readers to have access.

## 5. Edit the matching website article

1. Sign into CodeTips Academy as an administrator.
2. Open the Articles editor and find the relevant **Fine-Tuning Methods** series part.
3. Near the beginning of the body, add the generated descriptive GitHub link. If the editor supports a visual link tool, paste the URL there; in HTML/source mode paste the HTML snippet.
4. Keep the local notebook preview and ZIP download as a fallback if useful.
5. Save, open the public article, click the link, and confirm the notebook part number matches.

Example for Part 5, **after replacing the owner/repository with real values**:

```html
<p><a href="https://github.com/OWNER/REPOSITORY/blob/main/notebooks/05-lora-from-scratch.ipynb">Open the Part 5 LoRA notebook on GitHub</a></p>
```

These are admin body edits; no database migration or site rebuild is needed to change a link. The startup importer is one-time and retains later admin edits. If you send the final published repository URL in chat, its links can be verified and added to all ten website articles.

## Notebook-to-article mapping

| Part | Article | Notebook path |
| --- | --- | --- |
| 1 | What Is Fine-Tuning? Teach an Existing Model a New Job | `notebooks/01-what-is-fine-tuning.ipynb` |
| 2 | Prepare the Data and Build a Baseline Before Training | `notebooks/02-data-and-baselines.ipynb` |
| 3 | Full Fine-Tuning Versus a Frozen Encoder | `notebooks/03-full-and-head-tuning.ipynb` |
| 4 | Adapters, Bias-Only Updates, and Soft Prompts | `notebooks/04-adapters-and-peft.ipynb` |
| 5 | LoRA from Scratch: Two Small Matrices Instead of One Large Update | `notebooks/05-lora-from-scratch.ipynb` |
| 6 | Quantization and QLoRA: Understand the Memory Trade-Off | `notebooks/06-quantization-and-qlora.ipynb` |
| 7 | Supervised Fine-Tuning: Teach a Model the Desired Response | `notebooks/07-supervised-instruction-tuning.ipynb` |
| 8 | Preference Tuning and DPO: Learn Which Answer Is Better | `notebooks/08-preference-tuning-dpo.ipynb` |
| 9 | Evaluate, Compare, and Save Your Fine-Tuned Model | `notebooks/09-evaluate-and-save.ipynb` |
| 10 | Use a Pretrained Model and Publish Your Notebooks on GitHub | `notebooks/10-pretrained-model-and-publishing.ipynb` |

## What visitors can run

GitHub renders `.ipynb` files as static previews. It does not run Python or provide the notebook's kernel. Readers should clone/download the full project and follow README.md. Figures are stored in `assets/`, and executed outputs are included in the notebooks. GitHub may not render arbitrary interactive widgets; this project uses ordinary text and PNG outputs.

For a broken preview, first open the notebook locally with Jupyter. Check that it is valid JSON and that its Markdown image paths still point to `../assets/`. The project also includes ordinary HTML article previews.

Official reference: [GitHub notebook rendering](https://docs.github.com/en/repositories/working-with-files/using-files/working-with-non-code-files).
