PraisonAI 2.0.75__cp313-cp313-manylinux_2_39_x86_64.whl → 2.0.76__cp313-cp313-manylinux_2_39_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of PraisonAI might be problematic. Click here for more details.
- praisonai/deploy.py +1 -1
- praisonai/train_vision.py +71 -31
- {praisonai-2.0.75.dist-info → praisonai-2.0.76.dist-info}/METADATA +1 -1
- {praisonai-2.0.75.dist-info → praisonai-2.0.76.dist-info}/RECORD +7 -7
- {praisonai-2.0.75.dist-info → praisonai-2.0.76.dist-info}/LICENSE +0 -0
- {praisonai-2.0.75.dist-info → praisonai-2.0.76.dist-info}/WHEEL +0 -0
- {praisonai-2.0.75.dist-info → praisonai-2.0.76.dist-info}/entry_points.txt +0 -0
praisonai/deploy.py
CHANGED
|
@@ -56,7 +56,7 @@ class CloudDeployer:
|
|
|
56
56
|
file.write("FROM python:3.11-slim\n")
|
|
57
57
|
file.write("WORKDIR /app\n")
|
|
58
58
|
file.write("COPY . .\n")
|
|
59
|
-
file.write("RUN pip install flask praisonai==2.0.
|
|
59
|
+
file.write("RUN pip install flask praisonai==2.0.76 gunicorn markdown\n")
|
|
60
60
|
file.write("EXPOSE 8080\n")
|
|
61
61
|
file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
|
|
62
62
|
|
praisonai/train_vision.py
CHANGED
|
@@ -12,11 +12,14 @@ import yaml
|
|
|
12
12
|
import torch
|
|
13
13
|
import shutil
|
|
14
14
|
import subprocess
|
|
15
|
+
import gc # For garbage collection
|
|
15
16
|
|
|
16
|
-
from datasets import load_dataset, concatenate_datasets
|
|
17
|
+
from datasets import load_dataset, concatenate_datasets, Dataset
|
|
17
18
|
from unsloth import FastVisionModel, is_bf16_supported
|
|
18
19
|
from unsloth.trainer import UnslothVisionDataCollator
|
|
19
|
-
from
|
|
20
|
+
from transformers import TrainingArguments
|
|
21
|
+
from trl import SFTTrainer
|
|
22
|
+
from tqdm import tqdm # Add progress bar
|
|
20
23
|
|
|
21
24
|
|
|
22
25
|
class TrainVisionModel:
|
|
@@ -62,11 +65,21 @@ class TrainVisionModel:
|
|
|
62
65
|
use_gradient_checkpointing="unsloth"
|
|
63
66
|
)
|
|
64
67
|
print("DEBUG: Vision model and original tokenizer loaded.")
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
original_tokenizer.model_max_length = self.config.get("max_seq_length", 2048)
|
|
68
|
+
|
|
69
|
+
# Use the full processor that supports image inputs.
|
|
68
70
|
self.hf_tokenizer = original_tokenizer
|
|
69
71
|
|
|
72
|
+
# Set pad token if needed
|
|
73
|
+
if not hasattr(self.hf_tokenizer, 'pad_token') or self.hf_tokenizer.pad_token is None:
|
|
74
|
+
if hasattr(self.hf_tokenizer, 'eos_token'):
|
|
75
|
+
self.hf_tokenizer.pad_token = self.hf_tokenizer.eos_token
|
|
76
|
+
elif hasattr(self.hf_tokenizer, 'bos_token'):
|
|
77
|
+
self.hf_tokenizer.pad_token = self.hf_tokenizer.bos_token
|
|
78
|
+
|
|
79
|
+
# Set max length
|
|
80
|
+
if hasattr(self.hf_tokenizer, 'model_max_length'):
|
|
81
|
+
self.hf_tokenizer.model_max_length = self.config.get("max_seq_length", 2048)
|
|
82
|
+
|
|
70
83
|
# Add vision-specific LoRA adapters
|
|
71
84
|
self.model = FastVisionModel.get_peft_model(
|
|
72
85
|
self.model,
|
|
@@ -85,38 +98,62 @@ class TrainVisionModel:
|
|
|
85
98
|
print("DEBUG: Vision LoRA adapters added.")
|
|
86
99
|
|
|
87
100
|
def convert_sample(self, sample):
|
|
88
|
-
|
|
89
|
-
|
|
101
|
+
|
|
102
|
+
instruction = self.config.get(
|
|
103
|
+
"vision_instruction",
|
|
104
|
+
"You are an expert radiographer. Describe accurately what you see in this image."
|
|
105
|
+
)
|
|
90
106
|
conversation = [
|
|
91
|
-
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
107
|
+
{
|
|
108
|
+
"role": "user",
|
|
109
|
+
"content": [
|
|
110
|
+
{"type": "text", "text": instruction},
|
|
111
|
+
{"type": "image", "image": sample["image"]}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"role": "assistant",
|
|
116
|
+
"content": [
|
|
117
|
+
{"type": "text", "text": sample["caption"]}
|
|
118
|
+
]
|
|
119
|
+
},
|
|
98
120
|
]
|
|
121
|
+
|
|
99
122
|
return {"messages": conversation}
|
|
100
123
|
|
|
101
124
|
def load_datasets(self):
|
|
102
|
-
|
|
125
|
+
all_converted = []
|
|
103
126
|
for dataset_info in self.config["dataset"]:
|
|
104
|
-
print("
|
|
105
|
-
ds = load_dataset(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
127
|
+
print("\nDEBUG: Loading vision dataset:", dataset_info)
|
|
128
|
+
ds = load_dataset(
|
|
129
|
+
dataset_info["name"],
|
|
130
|
+
split=dataset_info.get("split_type", "train")
|
|
131
|
+
)
|
|
132
|
+
print("DEBUG: Dataset size:", len(ds))
|
|
133
|
+
print("DEBUG: First raw sample:", ds[0])
|
|
134
|
+
print("DEBUG: Dataset features:", ds.features)
|
|
135
|
+
|
|
136
|
+
print("\nDEBUG: Converting dataset to vision conversation format...")
|
|
137
|
+
converted_ds = [self.convert_sample(sample) for sample in ds]
|
|
138
|
+
|
|
139
|
+
# Debug first converted sample
|
|
140
|
+
print("\nDEBUG: First converted sample structure:")
|
|
141
|
+
first = converted_ds[0]
|
|
142
|
+
print("DEBUG: Message keys:", first["messages"][0]["content"][1].keys())
|
|
143
|
+
print("DEBUG: Image type in converted:", type(first["messages"][0]["content"][1].get("image")))
|
|
144
|
+
|
|
145
|
+
all_converted.extend(converted_ds)
|
|
146
|
+
|
|
147
|
+
print("\nDEBUG: Combined vision dataset has", len(all_converted), "examples.")
|
|
148
|
+
return all_converted
|
|
112
149
|
|
|
113
150
|
def train_model(self):
|
|
114
151
|
print("DEBUG: Starting vision training...")
|
|
115
152
|
raw_dataset = self.load_datasets()
|
|
116
153
|
|
|
117
|
-
# Build training arguments using
|
|
118
|
-
|
|
119
|
-
per_device_train_batch_size=self.config.get("per_device_train_batch_size",
|
|
154
|
+
# Build training arguments using TrainingArguments
|
|
155
|
+
training_args = TrainingArguments(
|
|
156
|
+
per_device_train_batch_size=self.config.get("per_device_train_batch_size", 1),
|
|
120
157
|
gradient_accumulation_steps=self.config.get("gradient_accumulation_steps", 4),
|
|
121
158
|
warmup_steps=self.config.get("warmup_steps", 5),
|
|
122
159
|
max_steps=self.config.get("max_steps", 30),
|
|
@@ -131,10 +168,9 @@ class TrainVisionModel:
|
|
|
131
168
|
output_dir=self.config.get("output_dir", "outputs"),
|
|
132
169
|
report_to="none" if not os.getenv("PRAISON_WANDB") else "wandb",
|
|
133
170
|
remove_unused_columns=False,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
max_seq_length=self.config.get("max_seq_length", 2048)
|
|
171
|
+
# Add memory optimization settings
|
|
172
|
+
gradient_checkpointing=True,
|
|
173
|
+
max_grad_norm=1.0,
|
|
138
174
|
)
|
|
139
175
|
|
|
140
176
|
trainer = SFTTrainer(
|
|
@@ -142,7 +178,11 @@ class TrainVisionModel:
|
|
|
142
178
|
tokenizer=self.hf_tokenizer,
|
|
143
179
|
data_collator=UnslothVisionDataCollator(self.model, self.hf_tokenizer),
|
|
144
180
|
train_dataset=raw_dataset,
|
|
145
|
-
args=
|
|
181
|
+
args=training_args,
|
|
182
|
+
max_seq_length=self.config.get("max_seq_length", 2048),
|
|
183
|
+
dataset_text_field="", # Required for vision training
|
|
184
|
+
dataset_kwargs={"skip_prepare_dataset": True}, # Required for vision training
|
|
185
|
+
packing=False # Explicitly set packing to False
|
|
146
186
|
)
|
|
147
187
|
print("DEBUG: Beginning vision trainer.train() ...")
|
|
148
188
|
trainer.train()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: PraisonAI
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.76
|
|
4
4
|
Summary: PraisonAI is an AI Agents Framework with Self Reflection. PraisonAI application combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient human-agent collaboration.
|
|
5
5
|
Author: Mervin Praison
|
|
6
6
|
Requires-Python: >=3.10,<3.13
|
|
@@ -5,7 +5,7 @@ praisonai/api/call.py,sha256=krOfTCZM_bdbsNuWQ1PijzCHECkDvEi9jIvvZaDQUUU,11035
|
|
|
5
5
|
praisonai/auto.py,sha256=uLDm8CU3L_3amZsd55yzf9RdBF1uW-BGSx7nl9ctNZ4,8680
|
|
6
6
|
praisonai/chainlit_ui.py,sha256=bNR7s509lp0I9JlJNvwCZRUZosC64qdvlFCt8NmFamQ,12216
|
|
7
7
|
praisonai/cli.py,sha256=hxGPiX8-LZanu2jiwBXIkMPm8Kk0Tt3LwDclLkUt0iY,26051
|
|
8
|
-
praisonai/deploy.py,sha256=
|
|
8
|
+
praisonai/deploy.py,sha256=qMsnRV4BINypSXTDo6olT_t1WQSsR8RGOqIr3advDq4,6028
|
|
9
9
|
praisonai/inbuilt_tools/__init__.py,sha256=fai4ZJIKz7-iOnGZv5jJX0wmT77PKa4x2jqyaJddKFA,569
|
|
10
10
|
praisonai/inbuilt_tools/autogen_tools.py,sha256=kJdEv61BTYvdHOaURNEpBcWq8Rs-oC03loNFTIjT-ak,4687
|
|
11
11
|
praisonai/inc/__init__.py,sha256=sPDlYBBwdk0VlWzaaM_lG0_LD07lS2HRGvPdxXJFiYg,62
|
|
@@ -34,7 +34,7 @@ praisonai/setup/setup_conda_env.sh,sha256=_pVbrXStZua6vUJTbuGiZam-zWsDDLWP0ZaFuP
|
|
|
34
34
|
praisonai/setup.py,sha256=0jHgKnIPCtBZiGYaYyTz3PzrJI6nBy55VXk2UctXlDo,373
|
|
35
35
|
praisonai/test.py,sha256=OL-wesjA5JTohr8rtr6kWoaS4ImkJg2l0GXJ-dUUfRU,4090
|
|
36
36
|
praisonai/train.py,sha256=Cjb0TKU3esNrCk2OX24Qm1S1crRC00FdiGUYJLw3iPQ,24094
|
|
37
|
-
praisonai/train_vision.py,sha256=
|
|
37
|
+
praisonai/train_vision.py,sha256=yPHJSE_5zUlu1piVOkL7rO8wat310l64FYd7QP2NW7U,11176
|
|
38
38
|
praisonai/ui/README.md,sha256=QG9yucvBieVjCjWFzu6hL9xNtYllkoqyJ_q1b0YYAco,1124
|
|
39
39
|
praisonai/ui/agents.py,sha256=1qsWE2yCaQKhuc-1uLHdMfZJeOXzBtp4pe5q7bk2EuA,32813
|
|
40
40
|
praisonai/ui/callbacks.py,sha256=V4_-GjxmjDFmugUZGfQHKtNSysx7rT6i1UblbM_8lIM,1968
|
|
@@ -83,8 +83,8 @@ praisonai/ui/realtimeclient/tools.py,sha256=IJOYwVOBW5Ocn5_iV9pFkmSKR3WU3YpX3kwF
|
|
|
83
83
|
praisonai/ui/sql_alchemy.py,sha256=oekZOXlRGMJ2SuC-lmgMMIzAmvbMg2DWeGTSpOzbVBM,29674
|
|
84
84
|
praisonai/ui/tools.md,sha256=Ad3YH_ZCLMWlz3mDXllQnQ_S5l55LWqLdcZSh-EXrHI,3956
|
|
85
85
|
praisonai/version.py,sha256=ugyuFliEqtAwQmH4sTlc16YXKYbFWDmfyk87fErB8-8,21
|
|
86
|
-
praisonai-2.0.
|
|
87
|
-
praisonai-2.0.
|
|
88
|
-
praisonai-2.0.
|
|
89
|
-
praisonai-2.0.
|
|
90
|
-
praisonai-2.0.
|
|
86
|
+
praisonai-2.0.76.dist-info/LICENSE,sha256=kqvFysVlnFxYOu0HxCe2HlmZmJtdmNGOxWRRkT9TsWc,1035
|
|
87
|
+
praisonai-2.0.76.dist-info/METADATA,sha256=o7uWffPS2DDjeOa3S5leLTLJnYMBJNK4P0SquIePstg,21942
|
|
88
|
+
praisonai-2.0.76.dist-info/WHEEL,sha256=OiNztsphQWM3l0xJ9BHQRElMnxzHbt1M68r2N60f8T8,110
|
|
89
|
+
praisonai-2.0.76.dist-info/entry_points.txt,sha256=I_xc6a6MNTTfLxYmAxe0rgey0G-_hbY07oFW-ZDnkw4,135
|
|
90
|
+
praisonai-2.0.76.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|