Elffuss BraidHub

kikocis/mlx-vlm public

Merge pull request #7 from Blaizzy/pc/update-image-processor

Update image processor
Changeset9705b4e74fecbd194af4c07c9c39b1c1962b5ca5b86bea188cccbcb0c6fe26b1
AuthorPrince Canuma <prince.gdt@gmail.com> · 2024-04-24 09:45 +02:00
CommitterGitHub <noreply@github.com> · 2024-04-24 09:45 +02:00
Parentsa23299d7284d, f16f6128be34

Browse the files at this changeset

15 files changed

modified mlx_vlm/__init__.py +1 −1
@@ -1,2 +1,2 @@
11 from .utils import convert, generate, load
2-from .version import __version__
No newline at the end of the file
2+from .version import __version__
modified mlx_vlm/convert.py +1 −1
@@ -59,4 +59,4 @@
5959
6060
6161 if __name__ == "__main__":
62- main()
No newline at the end of the file
62+ main()
modified mlx_vlm/generate.py +8 −6
@@ -2,10 +2,12 @@
22 import codecs
33
44 import mlx.core as mx
5-from .utils import load, load_config, load_image_processor, generate, get_model_path
65
6+from .utils import generate, get_model_path, load, load_config, load_image_processor
77
88 MODEL_TYPE = ""
9+
10+
911 def parse_arguments():
1012 parser = argparse.ArgumentParser(
1113 description="Generate text from an image using a model."
@@ -43,8 +45,7 @@
4345 def get_model_and_processors(model_path):
4446 model_path = get_model_path(model_path)
4547 model, processor = load(model_path, {"trust_remote_code": True})
46- config = load_config(model_path)
47- image_processor = load_image_processor(config)
48+ image_processor = load_image_processor(model_path)
4849 return model, processor, image_processor
4950
5051
@@ -55,7 +56,6 @@
5556 return mx.random.categorical(logits * (1 / temperature))
5657
5758
58-
5959 def main():
6060 args = parse_arguments()
6161 model, processor, image_processor = get_model_and_processors(args.model)
@@ -75,7 +75,9 @@
7575 add_generation_prompt=True,
7676 )
7777 else:
78- ValueError("Error: processor does not have 'chat_template' or 'tokenizer' attribute.")
78+ ValueError(
79+ "Error: processor does not have 'chat_template' or 'tokenizer' attribute."
80+ )
7981
8082 generate(
8183 model,
@@ -85,7 +87,7 @@
8587 image_processor,
8688 args.temp,
8789 args.max_tokens,
88- True
90+ True,
8991 )
9092
9193
modified mlx_vlm/models/base.py +17 −13
@@ -1,22 +1,27 @@
1-
21 from abc import ABC, abstractmethod
32 from typing import Dict
43
54 from transformers.image_processing_utils import get_size_dict
6-from transformers.image_utils import (ChannelDimension, PILImageResampling )
5+from transformers.image_utils import ChannelDimension, PILImageResampling
76
87
98 class BaseImageProcessor(ABC):
10- def __init__(self,
11- image_mean=(0.5, 0.5, 0.5),
12- image_std=(0.5, 0.5, 0.5),
13- size=(384, 384),
14- crop_size: Dict[str, int] = None,
15- resample=PILImageResampling.BICUBIC,
16- rescale_factor=1 / 255,
17- data_format=ChannelDimension.FIRST):
18- crop_size = crop_size if crop_size is not None else {"height": 384, "width": 384}
19- crop_size = get_size_dict(crop_size, default_to_square=True, param_name="crop_size")
9+ def __init__(
10+ self,
11+ image_mean=(0.5, 0.5, 0.5),
12+ image_std=(0.5, 0.5, 0.5),
13+ size=(384, 384),
14+ crop_size: Dict[str, int] = None,
15+ resample=PILImageResampling.BICUBIC,
16+ rescale_factor=1 / 255,
17+ data_format=ChannelDimension.FIRST,
18+ ):
19+ crop_size = (
20+ crop_size if crop_size is not None else {"height": 384, "width": 384}
21+ )
22+ crop_size = get_size_dict(
23+ crop_size, default_to_square=True, param_name="crop_size"
24+ )
2025
2126 self.image_mean = image_mean
2227 self.image_std = image_std
@@ -29,4 +34,3 @@
2934 @abstractmethod
3035 def preprocess(self, images):
3136 pass
32-
modified mlx_vlm/models/llava/__init__.py +8 −1
@@ -1,1 +1,8 @@
1-from .llava import Model, ModelConfig, VisionConfig, TextConfig, VisionModel, LanguageModel
1+from .llava import (
2+ LanguageModel,
3+ Model,
4+ ModelConfig,
5+ TextConfig,
6+ VisionConfig,
7+ VisionModel,
8+)
modified mlx_vlm/models/llava/language.py +0 −1
@@ -1,4 +1,3 @@
1-
21 import inspect
32 from dataclasses import dataclass
43 from typing import Dict, Optional, Tuple, Union
modified mlx_vlm/models/llava/llava.py +1 −2
@@ -1,5 +1,3 @@
1-
2-
31 import glob
42 import inspect
53 import json
@@ -11,6 +9,7 @@
119 import mlx.nn as nn
1210 import numpy as np
1311 from huggingface_hub import snapshot_download
12+
1413 from .language import LanguageModel, TextConfig
1514 from .vision import VisionConfig, VisionModel
1615
modified mlx_vlm/models/llava/vision.py +2 −2
@@ -1,5 +1,3 @@
1-
2-
31 import inspect
42 import math
53 from dataclasses import dataclass
@@ -33,6 +31,7 @@
3331 }
3432 )
3533
34+
3635 def check_array_shape(arr):
3736 shape = arr.shape
3837
@@ -48,6 +47,7 @@
4847 else:
4948 return False
5049
50+
5151 class Attention(nn.Module):
5252 def __init__(
5353 self,
modified mlx_vlm/models/nanoLlava/__init__.py +9 −1
@@ -1,1 +1,9 @@
1-from .nanoLlava import Model, ImageProcessor, ModelConfig, TextConfig, VisionConfig, VisionModel, LanguageModel
1+from .nanoLlava import (
2+ ImageProcessor,
3+ LanguageModel,
4+ Model,
5+ ModelConfig,
6+ TextConfig,
7+ VisionConfig,
8+ VisionModel,
9+)
modified mlx_vlm/models/nanoLlava/language.py +8 −6
@@ -6,7 +6,6 @@
66 import mlx.nn as nn
77
88
9-
109 @dataclass
1110 class TextConfig:
1211 model_type: str
@@ -162,13 +161,12 @@
162161 cache=None,
163162 inputs_embeds=None,
164163 ):
165- # for passing merged input embeddings
164+ # for passing merged input embeddings
166165 if inputs_embeds is None:
167166 h = self.embed_tokens(inputs)
168167 else:
169168 h = inputs_embeds
170169
171-
172170 mask = None
173171 if h.shape[1] > 1:
174172 mask = nn.MultiHeadAttention.create_additive_causal_mask(h.shape[1])
@@ -180,7 +178,6 @@
180178 for e, layer in enumerate(self.layers):
181179 h, cache[e] = layer(h, mask, cache[e])
182180
183-
184181 return self.lm_head(self.norm(h)), cache
185182
186183
@@ -201,8 +198,13 @@
201198 return out, cache
202199
203200 def sanitize(self, weights):
204- if self.args.tie_word_embeddings and "language_model.model.lm_head.weight" not in weights:
205- weights["language_model.model.lm_head.weight"] = weights["language_model.model.embed_tokens.weight"]
201+ if (
202+ self.args.tie_word_embeddings
203+ and "language_model.model.lm_head.weight" not in weights
204+ ):
205+ weights["language_model.model.lm_head.weight"] = weights[
206+ "language_model.model.embed_tokens.weight"
207+ ]
206208
207209 return {
208210 k: v for k, v in weights.items() if "self_attn.rotary_emb.inv_freq" not in k
modified mlx_vlm/models/nanoLlava/nanoLlava.py +73 −34
@@ -1,28 +1,31 @@
1-
2-import re
31 import glob
42 import inspect
53 import json
4+import re
65 from dataclasses import dataclass
6+from functools import partial, reduce
77 from pathlib import Path
8-from typing import Optional
8+from typing import Dict, Optional
99
1010 import mlx.core as mx
1111 import mlx.nn as nn
1212 import numpy as np
1313 from huggingface_hub import snapshot_download
14+from PIL import Image
1415 from transformers import AutoConfig
16+from transformers.image_transforms import (
17+ convert_to_rgb,
18+ normalize,
19+ rescale,
20+ resize,
21+ to_channel_dimension_format,
22+)
23+from transformers.image_utils import to_numpy_array
24+
25+from ..base import BaseImageProcessor
1526 from .language import LanguageModel, TextConfig
1627 from .vision import VisionConfig, VisionModel
17-from ..base import BaseImageProcessor
18-
1928
20-from typing import Optional, Dict
21-from dataclasses import dataclass
22-from functools import partial, reduce
23-from PIL import Image
24-from transformers.image_transforms import (convert_to_rgb, normalize, rescale, resize, to_channel_dimension_format, )
25-from transformers.image_utils import ( to_numpy_array, )
2629
2730 @dataclass
2831 class ModelConfig:
@@ -39,7 +42,6 @@
3942 image_token_index: int = -200
4043 vocab_size: int = 151936
4144
42-
4345 @classmethod
4446 def from_dict(cls, params):
4547 return cls(
@@ -61,16 +63,31 @@
6163 transforms = [
6264 convert_to_rgb,
6365 to_numpy_array,
64- partial(resize, size=self.size, resample=self.resample, data_format=self.data_format),
66+ partial(
67+ resize,
68+ size=self.size,
69+ resample=self.resample,
70+ data_format=self.data_format,
71+ ),
6572 partial(rescale, scale=self.rescale_factor, data_format=self.data_format),
66- partial(normalize, mean=self.image_mean, std=self.image_std, data_format=self.data_format),
67- partial(to_channel_dimension_format, channel_dim=self.data_format, input_channel_dim=self.data_format),
73+ partial(
74+ normalize,
75+ mean=self.image_mean,
76+ std=self.image_std,
77+ data_format=self.data_format,
78+ ),
79+ partial(
80+ to_channel_dimension_format,
81+ channel_dim=self.data_format,
82+ input_channel_dim=self.data_format,
83+ ),
6884 ]
6985
7086 images = reduce(lambda x, f: [*map(f, x)], transforms, images)
7187
7288 return images
7389
90+
7491 class LlavaMultiModalProjector(nn.Module):
7592 def __init__(self, config: ModelConfig):
7693 super().__init__()
@@ -88,6 +105,7 @@
88105 x = self.linear_2(x)
89106 return x
90107
108+
91109 class SigLipVisionTower(nn.Module):
92110 def __init__(self, config: VisionConfig):
93111 super().__init__()
@@ -98,6 +116,7 @@
98116 ) -> mx.array:
99117 return self.vision_tower(x, output_hidden_states)
100118
119+
101120 class Model(nn.Module):
102121 def __init__(self, config: ModelConfig):
103122 self.model_type = config.model_type
@@ -131,9 +150,7 @@
131150 )
132151 return final_inputs_embeds
133152
134- def _prepare_inputs_for_multimodal(
135- self, image_features, inputs_embeds, input_ids
136- ):
153+ def _prepare_inputs_for_multimodal(self, image_features, inputs_embeds, input_ids):
137154 image_token_index = self.config.image_token_index
138155 num_images, num_image_patches, embed_dim = image_features.shape
139156
@@ -161,12 +178,7 @@
161178 # (1, num_image_patches*num_images + sequence_len, embed_dim)
162179 return mx.concatenate(final_embeddings, axis=1)
163180
164- def __call__(
165- self,
166- input_ids: mx.array,
167- pixel_values: mx.array,
168- cache=None
169- ):
181+ def __call__(self, input_ids: mx.array, pixel_values: mx.array, cache=None):
170182 input_embeddings = self.get_input_embeddings(input_ids, pixel_values)
171183 logits, cache = self.language_model(
172184 inputs=input_ids, cache=cache, inputs_embeds=input_embeddings
@@ -187,7 +199,6 @@
187199 "tokenizer.model",
188200 "*.tiktoken",
189201 ],
190-
191202 )
192203 )
193204
@@ -221,21 +232,49 @@
221232 model.load_weights(list(weights.items()))
222233 return model
223234
224-
225235 def sanitize(self, weights):
226236 weights = {
227- f"{k.split('.', 1)[1]}" if re.match(r'^model\.vision_tower', k) else
228- f"mm_projector.linear_1.{k.split('.')[-1]}" if re.match(r'^model\.mm_projector\.0', k) else
229- f"mm_projector.linear_2.{k.split('.')[-1]}" if re.match(r'^model\.mm_projector\.2', k) else
230- f"language_model.model.{k}" if re.match(r'^lm_head', k) else
231- f"language_model.{k}" if re.match(r'^model\.(embed_tokens|norm|layers)', k) else k: v
237+ (
238+ f"{k.split('.', 1)[1]}"
239+ if re.match(r"^model\.vision_tower", k)
240+ else (
241+ f"mm_projector.linear_1.{k.split('.')[-1]}"
242+ if re.match(r"^model\.mm_projector\.0", k)
243+ else (
244+ f"mm_projector.linear_2.{k.split('.')[-1]}"
245+ if re.match(r"^model\.mm_projector\.2", k)
246+ else (
247+ f"language_model.model.{k}"
248+ if re.match(r"^lm_head", k)
249+ else (
250+ f"language_model.{k}"
251+ if re.match(r"^model\.(embed_tokens|norm|layers)", k)
252+ else k
253+ )
254+ )
255+ )
256+ )
257+ ): v
232258 for k, v in weights.items()
233259 }
234260
235261 weights = {
236- f"vision_tower.vision_tower.vision_model.head.attention.in_proj.bias" if re.match(r'^vision_tower\.vision_tower\.vision_model\.head\.attention\.in_proj_bias', k) else
237- f"vision_tower.vision_tower.vision_model.head.attention.in_proj.weight" if re.match(r'^vision_tower\.vision_tower\.vision_model\.head\.attention\.in_proj_weight', k) else k: v
262+ (
263+ f"vision_tower.vision_tower.vision_model.head.attention.in_proj.bias"
264+ if re.match(
265+ r"^vision_tower\.vision_tower\.vision_model\.head\.attention\.in_proj_bias",
266+ k,
267+ )
268+ else (
269+ f"vision_tower.vision_tower.vision_model.head.attention.in_proj.weight"
270+ if re.match(
271+ r"^vision_tower\.vision_tower\.vision_model\.head\.attention\.in_proj_weight",
272+ k,
273+ )
274+ else k
275+ )
276+ ): v
238277 for k, v in weights.items()
239278 }
240279
241- return weights
No newline at the end of the file
280+ return weights
modified mlx_vlm/models/nanoLlava/vision.py +2 −2
@@ -1,5 +1,3 @@
1-
2-
31 import inspect
42 from dataclasses import dataclass
53 from typing import Optional
@@ -32,6 +30,7 @@
3230 }
3331 )
3432
33+
3534 def check_array_shape(arr):
3635 shape = arr.shape
3736
@@ -47,6 +46,7 @@
4746 else:
4847 return False
4948
49+
5050 class Attention(nn.Module):
5151 def __init__(
5252 self,
modified mlx_vlm/tokenizer_utils.py +1 −1
@@ -329,4 +329,4 @@
329329 detokenizer_class,
330330 )
331331 else:
332- return detokenizer_class
No newline at the end of the file
332+ return detokenizer_class
modified mlx_vlm/utils.py +47 −25
@@ -1,28 +1,32 @@
1-
21 import copy
3-import re
42 import glob
53 import importlib
64 import json
75 import logging
6+import re
87 import shutil
98 import time
109 from pathlib import Path
1110 from textwrap import dedent
1211 from typing import Any, Callable, Dict, Generator, Optional, Tuple, Union
13-import requests
1412
1513 import mlx.core as mx
1614 import mlx.nn as nn
1715 import numpy as np
18-from PIL import Image
16+import requests
1917 from huggingface_hub import snapshot_download
2018 from mlx.utils import tree_flatten, tree_unflatten
21-from transformers import AutoConfig, AutoProcessor, PreTrainedTokenizer, PreTrainedTokenizerFast
19+from PIL import Image
20+from transformers import (
21+ AutoConfig,
22+ AutoProcessor,
23+ PreTrainedTokenizer,
24+ PreTrainedTokenizerFast,
25+)
2226
23-from .tokenizer_utils import TokenizerWrapper, load_tokenizer
2427 from .models.base import BaseImageProcessor
2528 from .sample_utils import top_p_sampling
29+from .tokenizer_utils import TokenizerWrapper, load_tokenizer
2630
2731 # Constants
2832 MODEL_REMAPPING = {
@@ -37,6 +41,7 @@
3741 != 8 # avoid quantizing gate layers, otherwise we have to re-quant and upload all the mixtral models
3842 )
3943
44+
4045 def get_model_and_args(config: dict):
4146 """
4247 Retrieve the model object based on the configuration.
@@ -56,7 +61,6 @@
5661 logging.error(msg)
5762 raise ValueError(msg)
5863
59-
6064 return arch, model_type
6165
6266
@@ -110,11 +114,9 @@
110114 ValueError: If the model class or args class are not found or cannot be instantiated.
111115 """
112116
113-
114117 config = load_config(model_path)
115118 quantization = config.get("quantization", None)
116119
117-
118120 weight_files = glob.glob(str(model_path / "*.safetensors"))
119121 if not weight_files:
120122 logging.error(f"No safetensors found in {model_path}")
@@ -124,7 +126,6 @@
124126 for wf in weight_files:
125127 weights.update(mx.load(wf))
126128
127-
128129 model_class, model_type = get_model_and_args(config=config)
129130
130131 if model_type == "nanoLlava":
@@ -136,15 +137,21 @@
136137 config["text_config"] = text_config
137138
138139 model_config = model_class.ModelConfig.from_dict(config)
139- model_config.vision_config = model_class.VisionConfig.from_dict(config["vision_config"])
140+ model_config.vision_config = model_class.VisionConfig.from_dict(
141+ config["vision_config"]
142+ )
140143 model_config.text_config = model_class.TextConfig.from_dict(config["text_config"])
141144 model = model_class.Model(model_config)
142145
143146 if hasattr(model, "sanitize"):
144147 weights = model.sanitize(weights)
145148
146- weights = model_class.VisionModel(model_config.vision_config).sanitize(weights=weights)
147- weights = model_class.LanguageModel(model_config.text_config).sanitize(weights=weights)
149+ weights = model_class.VisionModel(model_config.vision_config).sanitize(
150+ weights=weights
151+ )
152+ weights = model_class.LanguageModel(model_config.text_config).sanitize(
153+ weights=weights
154+ )
148155
149156 if (quantization := config.get("quantization", None)) is not None:
150157 # Handle legacy models which may not have everything quantized
@@ -197,6 +204,7 @@
197204
198205 return model, processor
199206
207+
200208 def load_config(model_path: Path) -> dict:
201209 try:
202210 with open(model_path / "config.json", "r") as f:
@@ -206,7 +214,12 @@
206214 raise
207215 return config
208216
209-def load_image_processor(config: dict) -> BaseImageProcessor:
217+
218+def load_image_processor(model_path: Union[str, Path]) -> BaseImageProcessor:
219+ if isinstance(model_path, str):
220+ model_path = get_model_path(model_path)
221+
222+ config = load_config(model_path)
210223 model_class, _ = get_model_and_args(config)
211224 image_processor = None
212225
@@ -215,7 +228,10 @@
215228
216229 return image_processor
217230
218-def load_processor(model_path, processor_config={"trust_remote_code": True}) -> Union[PreTrainedTokenizer, PreTrainedTokenizerFast]:
231+
232+def load_processor(
233+ model_path, processor_config={"trust_remote_code": True}
234+) -> Union[PreTrainedTokenizer, PreTrainedTokenizerFast]:
219235 processor = AutoProcessor.from_pretrained(model_path, **processor_config)
220236 detokenizer_class = load_tokenizer(model_path, return_tokenizer=False)
221237 if "tokenizer" in processor.__dict__.keys():
@@ -224,6 +240,7 @@
224240 processor.detokenizer = detokenizer_class(processor)
225241 return processor
226242
243+
227244 def fetch_from_hub(
228245 model_path: Path, lazy: bool = False
229246 ) -> Tuple[nn.Module, dict, PreTrainedTokenizer]:
@@ -270,6 +287,7 @@
270287 import os
271288
272289 from huggingface_hub import HfApi, ModelCard, logging
290+
273291 from . import __version__
274292
275293 card = ModelCard.load(hf_path)
@@ -303,6 +321,7 @@
303321 )
304322 print(f"Upload successful, go to https://huggingface.co/{upload_repo} for details.")
305323
324+
306325 def get_model_path(path_or_hf_repo: str, revision: Optional[str] = None) -> Path:
307326 """
308327 Ensures the model is available locally. If the path does not exist locally,
@@ -357,6 +376,7 @@
357376 logits[:, indices] = selected_logits
358377 return logits
359378
379+
360380 def save_weights(
361381 save_path: Union[str, Path],
362382 weights: Dict[str, Any],
@@ -408,9 +428,11 @@
408428 indent=4,
409429 )
410430
431+
411432 def class_predicate(path, m):
412433 return isinstance(m, nn.Linear) and not isinstance(m, nn.Embedding)
413434
435+
414436 def quantize_model(
415437 model: nn.Module, config: dict, q_group_size: int, q_bits: int
416438 ) -> Tuple:
@@ -456,6 +478,7 @@
456478 with open(config_path, "w") as fid:
457479 json.dump(config, fid, indent=4)
458480
481+
459482 def dequantize_model(model: nn.Module) -> nn.Module:
460483 """
461484 Dequantize the quantized linear layers in the model.
@@ -488,6 +511,7 @@
488511 model.update_modules(tree_unflatten(de_quantize_layers))
489512 return model
490513
514+
491515 def convert(
492516 hf_path: str,
493517 mlx_path: str = "mlx_model",
@@ -530,16 +554,14 @@
530554 for file in py_files:
531555 shutil.copy(file, mlx_path)
532556
533-
534557 tokenizer.save_pretrained(mlx_path)
535558
536-
537559 save_config(config, config_path=mlx_path / "config.json")
538560
539-
540561 if upload_repo is not None:
541562 upload_to_hub(mlx_path, upload_repo, hf_path)
542563
564+
543565 def load_image(image_source):
544566 """
545567 Helper function to load an image from either a URL or file.
@@ -563,6 +585,7 @@
563585 f"The image {image_source} must be a valid URL or existing file."
564586 )
565587
588+
566589 def prepare_inputs(image_processor, processor, image, prompt):
567590 if isinstance(image, str):
568591 image = load_image(image)
@@ -579,7 +602,8 @@
579602
580603 return input_ids, pixel_values
581604
582-def sample(logits: mx.array, temp:float, top_p:float) -> Tuple[mx.array, float]:
605+
606+def sample(logits: mx.array, temp: float, top_p: float) -> Tuple[mx.array, float]:
583607 softmax_logits = mx.softmax(logits)
584608
585609 if temp == 0:
@@ -593,10 +617,11 @@
593617 prob = softmax_logits[0, token]
594618 return token, prob
595619
620+
596621 def generate_step(
597622 model: nn.Module,
598623 prompt: mx.array,
599- cache = None,
624+ cache=None,
600625 temp: float = 0.0,
601626 repetition_penalty: Optional[float] = None,
602627 repetition_context_size: Optional[int] = 20,
@@ -656,7 +681,7 @@
656681 processor: PreTrainedTokenizer,
657682 image: str,
658683 prompt: str,
659- image_processor = None,
684+ image_processor=None,
660685 temp: float = 0.0,
661686 max_tokens: int = 100,
662687 verbose: bool = False,
@@ -686,7 +711,6 @@
686711 print("Image:", image, "\n")
687712 print("Prompt:", prompt)
688713
689-
690714 if image_processor is not None:
691715 prompt_tokens = mx.array(processor.encode(prompt))
692716 tokenizer = processor
@@ -699,7 +723,6 @@
699723 logits = logits[:, -1, :]
700724 y, _ = sample(logits, temp, top_p)
701725
702-
703726 tic = time.perf_counter()
704727 detokenizer = processor.detokenizer
705728 detokenizer.reset()
@@ -726,7 +749,6 @@
726749 if token == tokenizer.eos_token_id:
727750 break
728751
729-
730752 detokenizer.add_token(token)
731753
732754 if verbose:
@@ -753,4 +775,4 @@
753775 print(f"Prompt: {prompt_tps:.3f} tokens-per-sec")
754776 print(f"Generation: {gen_tps:.3f} tokens-per-sec")
755777
756- return detokenizer.text
No newline at the end of the file
778+ return detokenizer.text
modified setup.py +3 −2
@@ -1,6 +1,7 @@
11 import sys
22 from pathlib import Path
3-from setuptools import setup, find_packages
3+
4+from setuptools import find_packages, setup
45
56 # Get the project root directory
67 root_dir = Path(__file__).parent
@@ -31,4 +32,4 @@
3132 install_requires=requirements,
3233 packages=find_packages(where=root_dir),
3334 python_requires=">=3.8",
34-)
No newline at the end of the file
35+)