diff --git a/docker/Dockerfile b/docker/Dockerfile index 3842594c..72959d6c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.11-slim WORKDIR /app COPY . . -RUN pip install flask praisonai==2.0.73 gunicorn markdown +RUN pip install flask praisonai==2.0.74 gunicorn markdown EXPOSE 8080 CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"] diff --git a/docs/api/praisonai/deploy.html b/docs/api/praisonai/deploy.html index 8b901d0b..a02a5df3 100644 --- a/docs/api/praisonai/deploy.html +++ b/docs/api/praisonai/deploy.html @@ -110,7 +110,7 @@

Raises

file.write("FROM python:3.11-slim\n") file.write("WORKDIR /app\n") file.write("COPY . .\n") - file.write("RUN pip install flask praisonai==2.0.73 gunicorn markdown\n") + file.write("RUN pip install flask praisonai==2.0.74 gunicorn markdown\n") file.write("EXPOSE 8080\n") file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n') diff --git a/praisonai.rb b/praisonai.rb index 3612be5c..e739d98d 100644 --- a/praisonai.rb +++ b/praisonai.rb @@ -3,7 +3,7 @@ class Praisonai < Formula desc "AI tools for various AI applications" homepage "https://github.com/MervinPraison/PraisonAI" - url "https://github.com/MervinPraison/PraisonAI/archive/refs/tags/2.0.73.tar.gz" + url "https://github.com/MervinPraison/PraisonAI/archive/refs/tags/2.0.74.tar.gz" sha256 "1828fb9227d10f991522c3f24f061943a254b667196b40b1a3e4a54a8d30ce32" # Replace with actual SHA256 checksum license "MIT" diff --git a/praisonai/deploy.py b/praisonai/deploy.py index fe4a6bfe..b0495301 100644 --- a/praisonai/deploy.py +++ b/praisonai/deploy.py @@ -56,7 +56,7 @@ def create_dockerfile(self): file.write("FROM python:3.11-slim\n") file.write("WORKDIR /app\n") file.write("COPY . .\n") - file.write("RUN pip install flask praisonai==2.0.73 gunicorn markdown\n") + file.write("RUN pip install flask praisonai==2.0.74 gunicorn markdown\n") file.write("EXPOSE 8080\n") file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n') diff --git a/praisonai/train.py b/praisonai/train.py index 99d6fec8..8e19b0ec 100644 --- a/praisonai/train.py +++ b/praisonai/train.py @@ -216,25 +216,29 @@ def train_model(self): raw_dataset = self.load_datasets() tokenized_dataset = self.tokenize_dataset(raw_dataset) print("DEBUG: Dataset tokenization complete.") - training_args = TrainingArguments( - per_device_train_batch_size=self.config.get("per_device_train_batch_size", 2), - gradient_accumulation_steps=self.config.get("gradient_accumulation_steps", 2), - warmup_steps=self.config.get("warmup_steps", 50), - max_steps=self.config.get("max_steps", 2800), - learning_rate=self.config.get("learning_rate", 2e-4), - fp16=self.config.get("fp16", not is_bfloat16_supported()), - bf16=self.config.get("bf16", is_bfloat16_supported()), - logging_steps=self.config.get("logging_steps", 15), - optim=self.config.get("optim", "adamw_8bit"), - weight_decay=self.config.get("weight_decay", 0.01), - lr_scheduler_type=self.config.get("lr_scheduler_type", "linear"), - seed=self.config.get("seed", 3407), - output_dir=self.config.get("output_dir", "outputs"), - report_to="none" if not os.getenv("PRAISON_WANDB") else "wandb", - save_steps=self.config.get("save_steps", 100) if os.getenv("PRAISON_WANDB") else None, - run_name=os.getenv("PRAISON_WANDB_RUN_NAME", "praisonai-train") if os.getenv("PRAISON_WANDB") else None, - remove_unused_columns=self.config.get("remove_unused_columns", False), - ) + # Build the training arguments parameters dynamically + ta_params = { + "per_device_train_batch_size": self.config.get("per_device_train_batch_size", 2), + "gradient_accumulation_steps": self.config.get("gradient_accumulation_steps", 2), + "warmup_steps": self.config.get("warmup_steps", 50), + "max_steps": self.config.get("max_steps", 2800), + "learning_rate": self.config.get("learning_rate", 2e-4), + "fp16": self.config.get("fp16", not is_bfloat16_supported()), + "bf16": self.config.get("bf16", is_bfloat16_supported()), + "logging_steps": self.config.get("logging_steps", 15), + "optim": self.config.get("optim", "adamw_8bit"), + "weight_decay": self.config.get("weight_decay", 0.01), + "lr_scheduler_type": self.config.get("lr_scheduler_type", "linear"), + "seed": self.config.get("seed", 3407), + "output_dir": self.config.get("output_dir", "outputs"), + "report_to": "none" if not os.getenv("PRAISON_WANDB") else "wandb", + "remove_unused_columns": self.config.get("remove_unused_columns", False) + } + if os.getenv("PRAISON_WANDB"): + ta_params["save_steps"] = self.config.get("save_steps", 100) + ta_params["run_name"] = os.getenv("PRAISON_WANDB_RUN_NAME", "praisonai-train") + + training_args = TrainingArguments(**ta_params) # Since the dataset is pre-tokenized, we supply a dummy dataset_text_field. trainer = SFTTrainer( model=self.model, @@ -425,12 +429,16 @@ def prepare_modelfile_content(self): "template": """{{- if .System }}{{ .System }}{{ end }} {{- range $i, $_ := .Messages }} {{- $last := eq (len (slice $.Messages $i)) 1}} - {{- if eq .Role "user" }}<|User|>{{ .Content }} - {{- else if eq .Role "assistant" }}<|Assistant|>{{ .Content }}{{- if not $last }}<|end▁of▁sentence|>{{- end }} + {{- if eq .Role "user" }} + {{ .Content }} + {{- else if eq .Role "assistant" }} + {{ .Content }}{{- if not $last }} + {{- end }} {{- end }} - {{- if and $last (ne .Role "assistant") }}<|Assistant|>{{- end }} + {{- if and $last (ne .Role "assistant") }} + {{ end }} {{- end }}""", - "stop_tokens": ["<|begin▁of▁sentence|>", "<|end▁of▁sentence|>", "<|User|>", "<|Assistant|>"] + "stop_tokens": ["", "", "", ""] }, "llava": { "template": """{{- if .Suffix }}<|fim_prefix|>{{ .Prompt }}<|fim_suffix|>{{ .Suffix }}<|fim_middle|> diff --git a/pyproject.toml b/pyproject.toml index 45c974fe..c493d5a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "PraisonAI" -version = "2.0.73" +version = "2.0.74" description = "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." readme = "README.md" license = "" @@ -84,7 +84,7 @@ autogen = ["pyautogen>=0.2.19", "praisonai-tools>=0.0.7", "crewai"] [tool.poetry] name = "PraisonAI" -version = "2.0.73" +version = "2.0.74" description = "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." authors = ["Mervin Praison"] license = "" diff --git a/uv.lock b/uv.lock index c021e8ce..2aa369a4 100644 --- a/uv.lock +++ b/uv.lock @@ -3060,7 +3060,7 @@ wheels = [ [[package]] name = "praisonai" -version = "2.0.73" +version = "2.0.74" source = { editable = "." } dependencies = [ { name = "instructor" },