This repository contains small scripts and a notebook to convert conversation exports into a combined JSONL dataset suitable for fine-tuning a custom conversational model.
Watch the youtube video ! : https://www.youtube.com/watch?v=HIVIlWDrseQ
Files in this repo
Sanitize_instagram_data.py— convert an Instagram/Facebook messages JSON export into dialogue pairs (dialogue_pairs.jsonl). EditMY_NAMEandHER_NAMEto match the names used in your export.sanitize_dailyDialogue_data.py— convert DailyDialog text/topic files into pairwise JSONL (dailydialog_sanitized.jsonl).Merge_datasets.py— mergedialogue_pairs.jsonl(Instagram) anddailydialog_sanitized.jsonlintocombined_dataset.jsonl. (used dailydialog dataset to get more cohearency for the high max new tokens (human text messages are short and bland :) )Joi.ipynb— Colab notebook showing how to fine-tune with LoRA/PEFT using the combined dataset (4-bit quantization + LoRA). This notebook expectscombined_dataset.jsonlin the working directory.
Quick overview
- Download your Instagram/Facebook message archive (see detailed steps below).
- Put the exported JSON message file (commonly named
message_1.jsoninside themessagesfolder of the archive) in the same folder as these scripts. - Edit
Sanitize_instagram_data.pyto setMY_NAMEandHER_NAME. - Run the scripts to create
dialogue_pairs.jsonl, sanitize DailyDialog if needed, and merge withMerge_datasets.pyto producecombined_dataset.jsonl. - Open
Joi.ipynbin Colab (or locally) to fine-tune or experiment.
How to download your Instagram / Facebook messages (JSON)
- Go to https://www.facebook.com/settings (Facebook) while signed in.
- Click "Your Facebook Information" → "Download Your Information".
- Under "Select information to download", uncheck everything except "Messages".
- Choose "Format: JSON", the date range you need, and a reasonable media quality. For messages only, a small/medium media quality is fine.
- Click "Create File" and wait for Facebook to prepare the archive. When ready, download the zip archive.
- Extract the archive and locate the
messagesfolder. Inside it you'll find one or moremessage_*.jsonfiles. The script expectsmessage_1.jsonby default — either rename your file to that or changeINPUT_FILEinSanitize_instagram_data.py.
Notes about the message export
- The exported JSON structure varies slightly by account and export date. The sanitizer script reads
messagesand looks forsender_nameandcontent. If your messages use a different structure (for example, media-only messages or reactions) you may need to adapt the script.
Running the sanitizer scripts (Windows PowerShell examples)
- Instagram sanitizer (after adjusting names inside the file):
python .\Sanitize_instagram_data.pyThis creates dialogue_pairs.jsonl (one JSON object per line with {"input": ..., "output": ...}).
- DailyDialog sanitizer (if you have the original DailyDialog text/topic/emotion files):
Place dialogues_text.txt, dialogues_topic.txt, and dialogues_emotion.txt next to sanitize_dailyDialogue_data.py, then:
python .\sanitize_dailyDialogue_data.pyThis writes dailydialog_sanitized.jsonl.
- Merge the two datasets:
python .\Merge_datasets.pyThis writes combined_dataset.jsonl.
Using the notebook
- Upload
combined_dataset.jsonlto Colab (or place it next toJoi.ipynbif running locally). - Open
Joi.ipynband follow the cells. The notebook includes installation steps and an end-to-end example for applying LoRA adapters.
Dependencies
- The sanitizer and merging scripts use only the Python standard library (no extra packages needed).
- The notebook lists heavy ML dependencies. For convenience a
requirements.txtis included with the main packages used in the notebook.