Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install:

.PHONY: lint
lint: install
uv run ruff check --output-format=github .
uv run ruff check --output-format=github scripts
uv run nbqa ruff notebooks

.PHONY: format
Expand All @@ -27,7 +27,7 @@ format: install

.PHONY: typecheck
typecheck: install
uv run mypy .jupytext
uv run mypy scripts
uv run nbqa mypy notebooks

.PHONY: apply-formatter
Expand Down
3 changes: 1 addition & 2 deletions notebooks/4-2_clip.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@
},
{
"cell_type": "markdown",
"id": "634cf091-dc89-47a4-a7dd-623059b7655f",
"id": "6cf5440f-a7ee-4b38-95eb-5654f5562338",
"metadata": {},
"source": [
"### 画像とテキストのペアの構築"
Expand All @@ -519,7 +519,6 @@
"\n",
"import skimage\n",
"from more_itertools import sort_together\n",
"from PIL import Image\n",
"\n",
"original_imgs, original_txts = [], []\n",
"\n",
Expand Down
9 changes: 8 additions & 1 deletion notebooks/5-4-1_lora.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@
"cell_type": "code",
"execution_count": 6,
"id": "8d44b56e",
"metadata": {},
"metadata": {
"lines_to_next_cell": 2
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -216,6 +218,11 @@
"metadata": {},
"outputs": [],
"source": [
"import random\n",
"\n",
"import numpy as np\n",
"\n",
"\n",
"def tokenize_captions(examples, is_train=True):\n",
" # Preprocessing the datasets.\n",
" # We need to tokenize input captions and transform the images.\n",
Expand Down
1 change: 0 additions & 1 deletion scripts/4-2_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@

import skimage
from more_itertools import sort_together
from PIL import Image

original_imgs, original_txts = [], []

Expand Down
4 changes: 2 additions & 2 deletions scripts/5-1-1_textual-inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def training_function(
)
learning_rate = hparams.learning_rate
max_train_steps = hparams.max_train_steps
output_dir_path = hparams.output_dir_path
# output_dir_path = hparams.output_dir_path
gradient_checkpointing = hparams.gradient_checkpointing

# 学習を効率化する Accelerator の設定
Expand Down Expand Up @@ -579,7 +579,7 @@ def training_function(
pipeline.save_pretrained(hparams.output_dir_path)
# 新たに追加した概念に対応するパラメータも保存
save_path = os.path.join(
hparams.output_dir_path, f"learned_embeds.bin"
hparams.output_dir_path, "learned_embeds.bin"
)
save_progress(
text_encoder,
Expand Down