PraisonAI 2.0.61__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/__init__.py +6 -0
- praisonai/__main__.py +10 -0
- praisonai/agents_generator.py +648 -0
- praisonai/api/call.py +292 -0
- praisonai/auto.py +238 -0
- praisonai/chainlit_ui.py +304 -0
- praisonai/cli.py +518 -0
- praisonai/deploy.py +138 -0
- praisonai/inbuilt_tools/__init__.py +24 -0
- praisonai/inbuilt_tools/autogen_tools.py +117 -0
- praisonai/inc/__init__.py +2 -0
- praisonai/inc/config.py +96 -0
- praisonai/inc/models.py +128 -0
- praisonai/public/android-chrome-192x192.png +0 -0
- praisonai/public/android-chrome-512x512.png +0 -0
- praisonai/public/apple-touch-icon.png +0 -0
- praisonai/public/fantasy.svg +3 -0
- praisonai/public/favicon-16x16.png +0 -0
- praisonai/public/favicon-32x32.png +0 -0
- praisonai/public/favicon.ico +0 -0
- praisonai/public/game.svg +3 -0
- praisonai/public/logo_dark.png +0 -0
- praisonai/public/logo_light.png +0 -0
- praisonai/public/movie.svg +3 -0
- praisonai/public/praison-ai-agents-architecture-dark.png +0 -0
- praisonai/public/praison-ai-agents-architecture.png +0 -0
- praisonai/public/thriller.svg +3 -0
- praisonai/setup/__init__.py +1 -0
- praisonai/setup/build.py +21 -0
- praisonai/setup/config.yaml +60 -0
- praisonai/setup/post_install.py +23 -0
- praisonai/setup/setup_conda_env.py +25 -0
- praisonai/setup/setup_conda_env.sh +72 -0
- praisonai/setup.py +16 -0
- praisonai/test.py +105 -0
- praisonai/train.py +276 -0
- praisonai/ui/README.md +21 -0
- praisonai/ui/agents.py +822 -0
- praisonai/ui/callbacks.py +57 -0
- praisonai/ui/chat.py +387 -0
- praisonai/ui/code.py +440 -0
- praisonai/ui/colab.py +474 -0
- praisonai/ui/colab_chainlit.py +81 -0
- praisonai/ui/components/aicoder.py +269 -0
- praisonai/ui/config/.chainlit/config.toml +120 -0
- praisonai/ui/config/.chainlit/translations/bn.json +231 -0
- praisonai/ui/config/.chainlit/translations/en-US.json +229 -0
- praisonai/ui/config/.chainlit/translations/gu.json +231 -0
- praisonai/ui/config/.chainlit/translations/he-IL.json +231 -0
- praisonai/ui/config/.chainlit/translations/hi.json +231 -0
- praisonai/ui/config/.chainlit/translations/kn.json +231 -0
- praisonai/ui/config/.chainlit/translations/ml.json +231 -0
- praisonai/ui/config/.chainlit/translations/mr.json +231 -0
- praisonai/ui/config/.chainlit/translations/ta.json +231 -0
- praisonai/ui/config/.chainlit/translations/te.json +231 -0
- praisonai/ui/config/.chainlit/translations/zh-CN.json +229 -0
- praisonai/ui/config/chainlit.md +1 -0
- praisonai/ui/config/translations/bn.json +231 -0
- praisonai/ui/config/translations/en-US.json +229 -0
- praisonai/ui/config/translations/gu.json +231 -0
- praisonai/ui/config/translations/he-IL.json +231 -0
- praisonai/ui/config/translations/hi.json +231 -0
- praisonai/ui/config/translations/kn.json +231 -0
- praisonai/ui/config/translations/ml.json +231 -0
- praisonai/ui/config/translations/mr.json +231 -0
- praisonai/ui/config/translations/ta.json +231 -0
- praisonai/ui/config/translations/te.json +231 -0
- praisonai/ui/config/translations/zh-CN.json +229 -0
- praisonai/ui/context.py +283 -0
- praisonai/ui/db.py +291 -0
- praisonai/ui/public/fantasy.svg +3 -0
- praisonai/ui/public/game.svg +3 -0
- praisonai/ui/public/logo_dark.png +0 -0
- praisonai/ui/public/logo_light.png +0 -0
- praisonai/ui/public/movie.svg +3 -0
- praisonai/ui/public/praison.css +3 -0
- praisonai/ui/public/thriller.svg +3 -0
- praisonai/ui/realtime.py +476 -0
- praisonai/ui/realtimeclient/__init__.py +653 -0
- praisonai/ui/realtimeclient/realtimedocs.txt +1484 -0
- praisonai/ui/realtimeclient/tools.py +236 -0
- praisonai/ui/sql_alchemy.py +707 -0
- praisonai/ui/tools.md +133 -0
- praisonai/version.py +1 -0
- praisonai-2.0.61.dist-info/LICENSE +20 -0
- praisonai-2.0.61.dist-info/METADATA +679 -0
- praisonai-2.0.61.dist-info/RECORD +89 -0
- praisonai-2.0.61.dist-info/WHEEL +4 -0
- praisonai-2.0.61.dist-info/entry_points.txt +5 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# praisonai/inbuilt_tools/autogen_tools.py
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import inspect
|
|
5
|
+
|
|
6
|
+
# Try to import praisonai_tools, but don't fail if not available
|
|
7
|
+
try:
|
|
8
|
+
from praisonai_tools import (
|
|
9
|
+
CodeDocsSearchTool, CSVSearchTool, DirectorySearchTool, DOCXSearchTool,
|
|
10
|
+
DirectoryReadTool, FileReadTool, TXTSearchTool, JSONSearchTool,
|
|
11
|
+
MDXSearchTool, PDFSearchTool, RagTool, ScrapeElementFromWebsiteTool,
|
|
12
|
+
ScrapeWebsiteTool, WebsiteSearchTool, XMLSearchTool,
|
|
13
|
+
YoutubeChannelSearchTool, YoutubeVideoSearchTool
|
|
14
|
+
)
|
|
15
|
+
TOOLS_AVAILABLE = True
|
|
16
|
+
except ImportError:
|
|
17
|
+
TOOLS_AVAILABLE = False
|
|
18
|
+
|
|
19
|
+
def create_autogen_tool_function(tool_class):
|
|
20
|
+
"""
|
|
21
|
+
Create a function that wraps a tool for autogen.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
tool_class: The tool class to wrap
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
function: A function that can be used with autogen agents
|
|
28
|
+
"""
|
|
29
|
+
if not TOOLS_AVAILABLE:
|
|
30
|
+
return None
|
|
31
|
+
|
|
32
|
+
def tool_function(assistant, user_proxy):
|
|
33
|
+
"""
|
|
34
|
+
Wrapper function for the tool that works with autogen.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
assistant: The autogen assistant agent
|
|
38
|
+
user_proxy: The autogen user proxy agent
|
|
39
|
+
"""
|
|
40
|
+
tool_instance = tool_class()
|
|
41
|
+
|
|
42
|
+
# Get the tool's run method signature
|
|
43
|
+
sig = inspect.signature(tool_instance.run)
|
|
44
|
+
param_names = list(sig.parameters.keys())
|
|
45
|
+
|
|
46
|
+
def wrapped_function(*args, **kwargs):
|
|
47
|
+
try:
|
|
48
|
+
# Map positional arguments to named parameters
|
|
49
|
+
named_args = dict(zip(param_names, args))
|
|
50
|
+
# Combine with keyword arguments
|
|
51
|
+
all_args = {**named_args, **kwargs}
|
|
52
|
+
# Run the tool
|
|
53
|
+
result = tool_instance.run(**all_args)
|
|
54
|
+
return str(result)
|
|
55
|
+
except Exception as e:
|
|
56
|
+
logging.error(f"Error running {tool_class.__name__}: {str(e)}")
|
|
57
|
+
return f"Error: {str(e)}"
|
|
58
|
+
|
|
59
|
+
# Add the function to the assistant's function map
|
|
60
|
+
assistant.register_function(
|
|
61
|
+
function_map={
|
|
62
|
+
tool_class.__name__: wrapped_function
|
|
63
|
+
},
|
|
64
|
+
name_to_args={
|
|
65
|
+
tool_class.__name__: {
|
|
66
|
+
param: "" for param in param_names
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
description=tool_instance.__doc__ or f"Use {tool_class.__name__} to perform operations"
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
return tool_function if TOOLS_AVAILABLE else None
|
|
73
|
+
|
|
74
|
+
# Only create tool functions if praisonai_tools is available
|
|
75
|
+
if TOOLS_AVAILABLE:
|
|
76
|
+
# Create autogen wrapper functions for each tool
|
|
77
|
+
autogen_CSVSearchTool = create_autogen_tool_function(CSVSearchTool)
|
|
78
|
+
autogen_CodeDocsSearchTool = create_autogen_tool_function(CodeDocsSearchTool)
|
|
79
|
+
autogen_DirectorySearchTool = create_autogen_tool_function(DirectorySearchTool)
|
|
80
|
+
autogen_DOCXSearchTool = create_autogen_tool_function(DOCXSearchTool)
|
|
81
|
+
autogen_DirectoryReadTool = create_autogen_tool_function(DirectoryReadTool)
|
|
82
|
+
autogen_FileReadTool = create_autogen_tool_function(FileReadTool)
|
|
83
|
+
autogen_TXTSearchTool = create_autogen_tool_function(TXTSearchTool)
|
|
84
|
+
autogen_JSONSearchTool = create_autogen_tool_function(JSONSearchTool)
|
|
85
|
+
autogen_MDXSearchTool = create_autogen_tool_function(MDXSearchTool)
|
|
86
|
+
autogen_PDFSearchTool = create_autogen_tool_function(PDFSearchTool)
|
|
87
|
+
autogen_RagTool = create_autogen_tool_function(RagTool)
|
|
88
|
+
autogen_ScrapeElementFromWebsiteTool = create_autogen_tool_function(ScrapeElementFromWebsiteTool)
|
|
89
|
+
autogen_ScrapeWebsiteTool = create_autogen_tool_function(ScrapeWebsiteTool)
|
|
90
|
+
autogen_WebsiteSearchTool = create_autogen_tool_function(WebsiteSearchTool)
|
|
91
|
+
autogen_XMLSearchTool = create_autogen_tool_function(XMLSearchTool)
|
|
92
|
+
autogen_YoutubeChannelSearchTool = create_autogen_tool_function(YoutubeChannelSearchTool)
|
|
93
|
+
autogen_YoutubeVideoSearchTool = create_autogen_tool_function(YoutubeVideoSearchTool)
|
|
94
|
+
|
|
95
|
+
# Export all tool functions
|
|
96
|
+
__all__ = [
|
|
97
|
+
'autogen_CSVSearchTool',
|
|
98
|
+
'autogen_CodeDocsSearchTool',
|
|
99
|
+
'autogen_DirectorySearchTool',
|
|
100
|
+
'autogen_DOCXSearchTool',
|
|
101
|
+
'autogen_DirectoryReadTool',
|
|
102
|
+
'autogen_FileReadTool',
|
|
103
|
+
'autogen_TXTSearchTool',
|
|
104
|
+
'autogen_JSONSearchTool',
|
|
105
|
+
'autogen_MDXSearchTool',
|
|
106
|
+
'autogen_PDFSearchTool',
|
|
107
|
+
'autogen_RagTool',
|
|
108
|
+
'autogen_ScrapeElementFromWebsiteTool',
|
|
109
|
+
'autogen_ScrapeWebsiteTool',
|
|
110
|
+
'autogen_WebsiteSearchTool',
|
|
111
|
+
'autogen_XMLSearchTool',
|
|
112
|
+
'autogen_YoutubeChannelSearchTool',
|
|
113
|
+
'autogen_YoutubeVideoSearchTool',
|
|
114
|
+
]
|
|
115
|
+
else:
|
|
116
|
+
# If tools are not available, export an empty list
|
|
117
|
+
__all__ = []
|
praisonai/inc/config.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
def generate_config(
|
|
2
|
+
ollama_save=None,
|
|
3
|
+
huggingface_save=None,
|
|
4
|
+
train=None,
|
|
5
|
+
model_name=None,
|
|
6
|
+
hf_model_name=None,
|
|
7
|
+
ollama_model_name=None,
|
|
8
|
+
model_parameters=None,
|
|
9
|
+
max_seq_length=None,
|
|
10
|
+
load_in_4bit=None,
|
|
11
|
+
lora_r=None,
|
|
12
|
+
lora_target_modules=None,
|
|
13
|
+
lora_alpha=None,
|
|
14
|
+
lora_dropout=None,
|
|
15
|
+
lora_bias=None,
|
|
16
|
+
use_gradient_checkpointing=None,
|
|
17
|
+
random_state=None,
|
|
18
|
+
use_rslora=None,
|
|
19
|
+
loftq_config=None,
|
|
20
|
+
dataset=None,
|
|
21
|
+
dataset_text_field=None,
|
|
22
|
+
dataset_num_proc=None,
|
|
23
|
+
packing=None,
|
|
24
|
+
per_device_train_batch_size=None,
|
|
25
|
+
gradient_accumulation_steps=None,
|
|
26
|
+
warmup_steps=None,
|
|
27
|
+
num_train_epochs=None,
|
|
28
|
+
max_steps=None,
|
|
29
|
+
learning_rate=None,
|
|
30
|
+
logging_steps=None,
|
|
31
|
+
optim=None,
|
|
32
|
+
weight_decay=None,
|
|
33
|
+
lr_scheduler_type=None,
|
|
34
|
+
seed=None,
|
|
35
|
+
output_dir=None,
|
|
36
|
+
quantization_method=None
|
|
37
|
+
):
|
|
38
|
+
"""Generates the configuration for PraisonAI with dynamic overrides."""
|
|
39
|
+
|
|
40
|
+
config = {
|
|
41
|
+
"ollama_save": ollama_save or "true",
|
|
42
|
+
"huggingface_save": huggingface_save or "true",
|
|
43
|
+
"train": train or "true",
|
|
44
|
+
|
|
45
|
+
"model_name": model_name or "unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit",
|
|
46
|
+
"hf_model_name": hf_model_name or "mervinpraison/llama-3.1-tamilan-8B-test",
|
|
47
|
+
"ollama_model": ollama_model_name or "mervinpraison/llama3.1-tamilan-test",
|
|
48
|
+
"model_parameters": model_parameters or "8b",
|
|
49
|
+
|
|
50
|
+
"dataset": dataset or [
|
|
51
|
+
{
|
|
52
|
+
"name": "yahma/alpaca-cleaned",
|
|
53
|
+
"split_type": "train",
|
|
54
|
+
"processing_func": "format_prompts",
|
|
55
|
+
"rename": {"input": "input", "output": "output", "instruction": "instruction"},
|
|
56
|
+
"filter_data": False,
|
|
57
|
+
"filter_column_value": "id",
|
|
58
|
+
"filter_value": "alpaca",
|
|
59
|
+
"num_samples": 20000
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
|
|
63
|
+
"dataset_text_field": dataset_text_field or "text",
|
|
64
|
+
"dataset_num_proc": dataset_num_proc or 2,
|
|
65
|
+
"packing": packing or False,
|
|
66
|
+
|
|
67
|
+
"max_seq_length": max_seq_length or 2048,
|
|
68
|
+
"load_in_4bit": load_in_4bit or True,
|
|
69
|
+
"lora_r": lora_r or 16,
|
|
70
|
+
"lora_target_modules": lora_target_modules or [
|
|
71
|
+
"q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"
|
|
72
|
+
],
|
|
73
|
+
"lora_alpha": lora_alpha or 16,
|
|
74
|
+
"lora_dropout": lora_dropout or 0,
|
|
75
|
+
"lora_bias": lora_bias or "none",
|
|
76
|
+
"use_gradient_checkpointing": use_gradient_checkpointing or "unsloth",
|
|
77
|
+
"random_state": random_state or 3407,
|
|
78
|
+
"use_rslora": use_rslora or False,
|
|
79
|
+
"loftq_config": loftq_config or None,
|
|
80
|
+
|
|
81
|
+
"per_device_train_batch_size": per_device_train_batch_size or 2,
|
|
82
|
+
"gradient_accumulation_steps": gradient_accumulation_steps or 2,
|
|
83
|
+
"warmup_steps": warmup_steps or 5,
|
|
84
|
+
"num_train_epochs": num_train_epochs or 1,
|
|
85
|
+
"max_steps": max_steps or 10,
|
|
86
|
+
"learning_rate": learning_rate or 2.0e-4,
|
|
87
|
+
"logging_steps": logging_steps or 1,
|
|
88
|
+
"optim": optim or "adamw_8bit",
|
|
89
|
+
"weight_decay": weight_decay or 0.01,
|
|
90
|
+
"lr_scheduler_type": lr_scheduler_type or "linear",
|
|
91
|
+
"seed": seed or 3407,
|
|
92
|
+
"output_dir": output_dir or "outputs",
|
|
93
|
+
|
|
94
|
+
"quantization_method": quantization_method or ["q4_k_m"]
|
|
95
|
+
}
|
|
96
|
+
return config
|
praisonai/inc/models.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# praisonai/inc/models.py
|
|
2
|
+
import os
|
|
3
|
+
import logging
|
|
4
|
+
logger = logging.getLogger(__name__)
|
|
5
|
+
logging.basicConfig(level=os.environ.get('LOGLEVEL', 'INFO').upper(), format='%(asctime)s - %(levelname)s - %(message)s')
|
|
6
|
+
|
|
7
|
+
# Conditionally import modules based on availability
|
|
8
|
+
try:
|
|
9
|
+
from langchain_openai import ChatOpenAI # pip install langchain-openai
|
|
10
|
+
OPENAI_AVAILABLE = True
|
|
11
|
+
except ImportError:
|
|
12
|
+
OPENAI_AVAILABLE = False
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
from langchain_google_genai import ChatGoogleGenerativeAI # pip install langchain-google-genai
|
|
16
|
+
GOOGLE_GENAI_AVAILABLE = True
|
|
17
|
+
except ImportError:
|
|
18
|
+
GOOGLE_GENAI_AVAILABLE = False
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
from langchain_anthropic import ChatAnthropic # pip install langchain-anthropic
|
|
22
|
+
ANTHROPIC_AVAILABLE = True
|
|
23
|
+
except ImportError:
|
|
24
|
+
ANTHROPIC_AVAILABLE = False
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
from langchain_cohere import ChatCohere # pip install langchain-cohere
|
|
28
|
+
COHERE_AVAILABLE = True
|
|
29
|
+
except ImportError:
|
|
30
|
+
COHERE_AVAILABLE = False
|
|
31
|
+
|
|
32
|
+
class PraisonAIModel:
|
|
33
|
+
def __init__(self, model=None, api_key_var=None, base_url=None):
|
|
34
|
+
"""
|
|
35
|
+
Initializes the PraisonAIModel with the provided parameters or environment variables.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
model (str, optional): The name of the OpenAI model. Defaults to None.
|
|
39
|
+
api_key_var (str, optional): The OpenAI API key. Defaults to None.
|
|
40
|
+
base_url (str, optional): The base URL for the OpenAI API. Defaults to None.
|
|
41
|
+
"""
|
|
42
|
+
self.model = model or os.getenv("OPENAI_MODEL_NAME", "gpt-4o")
|
|
43
|
+
if self.model.startswith("openai/"):
|
|
44
|
+
self.api_key_var = "OPENAI_API_KEY"
|
|
45
|
+
self.base_url = base_url or "https://api.openai.com/v1"
|
|
46
|
+
self.model_name = self.model.replace("openai/", "")
|
|
47
|
+
elif self.model.startswith("groq/"):
|
|
48
|
+
self.api_key_var = "GROQ_API_KEY"
|
|
49
|
+
self.base_url = base_url or "https://api.groq.com/openai/v1"
|
|
50
|
+
self.model_name = self.model.replace("groq/", "")
|
|
51
|
+
elif self.model.startswith("cohere/"):
|
|
52
|
+
self.api_key_var = "COHERE_API_KEY"
|
|
53
|
+
self.base_url = ""
|
|
54
|
+
self.model_name = self.model.replace("cohere/", "")
|
|
55
|
+
elif self.model.startswith("ollama/"):
|
|
56
|
+
self.api_key_var = "OLLAMA_API_KEY"
|
|
57
|
+
self.base_url = base_url or "http://localhost:11434/v1"
|
|
58
|
+
self.model_name = self.model.replace("ollama/", "")
|
|
59
|
+
elif self.model.startswith("anthropic/"):
|
|
60
|
+
self.api_key_var = "ANTHROPIC_API_KEY"
|
|
61
|
+
self.base_url = ""
|
|
62
|
+
self.model_name = self.model.replace("anthropic/", "")
|
|
63
|
+
elif self.model.startswith("google/"):
|
|
64
|
+
self.api_key_var = "GOOGLE_API_KEY"
|
|
65
|
+
self.base_url = ""
|
|
66
|
+
self.model_name = self.model.replace("google/", "")
|
|
67
|
+
elif self.model.startswith("openrouter/"):
|
|
68
|
+
self.api_key_var = "OPENROUTER_API_KEY"
|
|
69
|
+
self.base_url = base_url or "https://openrouter.ai/api/v1"
|
|
70
|
+
self.model_name = self.model.replace("openrouter/", "")
|
|
71
|
+
else:
|
|
72
|
+
self.api_key_var = api_key_var or "OPENAI_API_KEY"
|
|
73
|
+
self.base_url = base_url or os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1")
|
|
74
|
+
self.model_name = self.model
|
|
75
|
+
logger.debug(f"Initialized PraisonAIModel with model {self.model_name}, api_key_var {self.api_key_var}, and base_url {self.base_url}")
|
|
76
|
+
self.api_key = os.environ.get(self.api_key_var, "nokey")
|
|
77
|
+
|
|
78
|
+
def get_model(self):
|
|
79
|
+
"""
|
|
80
|
+
Returns an instance of the langchain Chat client with the configured parameters.
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
Chat: An instance of the langchain Chat client.
|
|
84
|
+
"""
|
|
85
|
+
if self.model.startswith("google/"):
|
|
86
|
+
if GOOGLE_GENAI_AVAILABLE:
|
|
87
|
+
return ChatGoogleGenerativeAI(
|
|
88
|
+
model=self.model_name,
|
|
89
|
+
google_api_key=self.api_key
|
|
90
|
+
)
|
|
91
|
+
else:
|
|
92
|
+
raise ImportError(
|
|
93
|
+
"Required Langchain Integration 'langchain-google-genai' not found. "
|
|
94
|
+
"Please install with 'pip install langchain-google-genai'"
|
|
95
|
+
)
|
|
96
|
+
elif self.model.startswith("cohere/"):
|
|
97
|
+
if COHERE_AVAILABLE:
|
|
98
|
+
return ChatCohere(
|
|
99
|
+
model=self.model_name,
|
|
100
|
+
cohere_api_key=self.api_key,
|
|
101
|
+
)
|
|
102
|
+
else:
|
|
103
|
+
raise ImportError(
|
|
104
|
+
"Required Langchain Integration 'langchain-cohere' not found. "
|
|
105
|
+
"Please install with 'pip install langchain-cohere'"
|
|
106
|
+
)
|
|
107
|
+
elif self.model.startswith("anthropic/"):
|
|
108
|
+
if ANTHROPIC_AVAILABLE:
|
|
109
|
+
return ChatAnthropic(
|
|
110
|
+
model=self.model_name,
|
|
111
|
+
anthropic_api_key=self.api_key,
|
|
112
|
+
)
|
|
113
|
+
else:
|
|
114
|
+
raise ImportError(
|
|
115
|
+
"Required Langchain Integration 'langchain-anthropic' not found. "
|
|
116
|
+
"Please install with 'pip install langchain-anthropic'"
|
|
117
|
+
)
|
|
118
|
+
elif OPENAI_AVAILABLE:
|
|
119
|
+
return ChatOpenAI(
|
|
120
|
+
model=self.model_name,
|
|
121
|
+
api_key=self.api_key,
|
|
122
|
+
base_url=self.base_url,
|
|
123
|
+
)
|
|
124
|
+
else:
|
|
125
|
+
raise ImportError(
|
|
126
|
+
"Required Langchain Integration 'langchain-openai' not found. "
|
|
127
|
+
"Please install with 'pip install langchain-openai'"
|
|
128
|
+
)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
3
|
+
<svg width="800px" height="800px" viewBox="0 0 1024 1024" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M840.5 798.2L662.3 599.5l-151 173.7-173.7-173.7-167.7 201c-21 30.4 0.9 71.8 37.9 71.6l594.7-3.3c36.2-0.1 57.8-40.3 38-70.6z" fill="#FFB89A" /><path d="M741.6 647.3l-52.3-47.7c-12.2-11.2-31.2-10.3-42.4 1.9s-10.3 31.2 1.9 42.4l52.3 47.7c5.8 5.3 13 7.8 20.2 7.8 8.1 0 16.2-3.3 22.2-9.8 11.2-12.1 10.3-31.1-1.9-42.3zM631.2 546.5c-12.4-11-31.4-9.8-42.3 2.6l-98.8 111.7-171-165.7L87.9 724.7c-11.8 11.7-11.8 30.7-0.1 42.4 5.9 5.9 13.6 8.9 21.3 8.9 7.6 0 15.3-2.9 21.1-8.7l189.4-188.1 173.8 168.5L633.8 589c11-12.5 9.8-31.5-2.6-42.5z" fill="#33CC99" /><path d="M721.3 342.8m-35.1 0a35.1 35.1 0 1 0 70.2 0 35.1 35.1 0 1 0-70.2 0Z" fill="#33CC99" /><path d="M743.2 175.1H191.6c-70.6 0-128.3 57.7-128.3 128.3v499.2c0 70.6 57.7 128.3 128.3 128.3h551.5c70.6 0 128.3-57.7 128.3-128.3V303.5c0.1-70.6-57.7-128.4-128.2-128.4z m68.3 627.6c0 18.1-7.1 35.2-20.1 48.2-13 13-30.1 20.1-48.2 20.1H191.6c-18.1 0-35.2-7.1-48.2-20.1-13-13-20.1-30.1-20.1-48.2V303.5c0-18.1 7.1-35.2 20.1-48.2 13-13 30.1-20.1 48.2-20.1h551.5c18.1 0 35.2 7.1 48.2 20.1 13 13 20.1 30.1 20.1 48.2v499.2z" fill="#45484C" /><path d="M799.7 90.9H237.2c-16.6 0-30 13.4-30 30s13.4 30 30 30h562.4c26.1 0 50.8 10.3 69.4 28.9 18.6 18.6 28.9 43.3 28.9 69.4v482.4c0 16.6 13.4 30 30 30s30-13.4 30-30V249.2C958 161.9 887 90.9 799.7 90.9z" fill="#45484C" /></svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
3
|
+
<svg width="800px" height="800px" viewBox="0 0 1024 1024" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M570.2 842c-50.6 0-278.7-180-278.7-401.9 0-58.8-2.9-133.1-1-183.9-50.8 3.2-91.4 45.7-91.4 97.3v272.1c37.4 194.7 137.5 334 255.2 334 69.5 0 132.9-48.6 180.9-128.5-20.8 7.1-42.6 10.9-65 10.9z" fill="#FFB89A" /><path d="M926.1 191.8C900.5 74.1 817.9 62.1 704.9 62.1c-29.1 0-60.3 0.8-93 0.8-36 0-70.5-1.1-102.5-1.1-109.7 0-189.8 12.5-201.3 123.7-20.4 198.3 30 617.1 306.1 617.1S939 414.3 926.1 191.8z m-76.9 268.5c-9.5 47.9-22.3 90.8-38.1 127.7-16.8 39.2-37 71.4-60 95.8-37.3 39.5-82.1 58.7-137 58.7-53.4 0-97.6-20.1-134.9-61.6-45.5-50.5-79.8-131.5-99-234.2-15.6-83.5-20.3-178.9-12.4-255.2 1.8-17.3 5.7-30.7 11.6-39.8 4.4-6.8 10.1-11.7 18.7-15.8 25.8-12.5 70.8-14.2 111.4-14.2 15 0 30.7 0.2 47.3 0.5 17.8 0.3 36.2 0.6 55.2 0.6 17.2 0 33.9-0.2 50-0.4 15.1-0.2 29.3-0.4 43.1-0.4 44.5 0 89.5 1.8 118 15.1 15.9 7.4 33.4 20.8 43.6 63 2.6 53.3 3.6 153.5-17.5 260.2z" fill="#4E5155" /><path d="M532 841.7c-32.5 22.3-70.6 33.7-113.2 33.7-29.7 0-57.3-6-82.1-17.7-23.2-11-44.7-27.4-63.9-48.7-46-50.9-80.3-131.3-99.2-232.4-15.1-80.6-19.6-172.9-12-246.8 3-29.5 12-50.2 27.5-63.2 14.2-12 35.1-19.2 65.8-22.9 16.5-2 28.2-16.9 26.3-33.3-2-16.5-16.9-28.2-33.3-26.3-42.9 5.1-73.8 16.7-97.4 36.5-27.9 23.5-43.8 57.2-48.5 103-8.2 79.3-3.4 178.1 12.7 264 9.7 51.9 23.4 99.4 40.6 141.2 19.8 48.1 44.4 88.6 73 120.4 51.6 57.2 115.7 86.2 190.6 86.2 55 0 104.5-14.9 147.2-44.2 13.7-9.4 17.1-28.1 7.7-41.7-9.4-13.7-28.1-17.2-41.8-7.8z" fill="#4E5155" /><path d="M519.7 248.5c-16.6 0-30 13.4-30 30v91.3c0 16.6 13.4 30 30 30s30-13.4 30-30v-91.3c0-16.6-13.5-30-30-30zM299.5 385.5c0-16.6-13.4-30-30-30s-30 13.4-30 30v91.3c0 16.6 13.4 30 30 30s30-13.4 30-30v-91.3zM754.6 248.5c-16.6 0-30 13.4-30 30v91.3c0 16.6 13.4 30 30 30s30-13.4 30-30v-91.3c0-16.6-13.4-30-30-30zM716.7 554.5c0-16.6-13.4-30-30-30H551v30c0 58.5 38.1 123.7 92.8 123.7 22.9 0 45-11.9 62.2-33.6 10.3-13 8.1-31.9-4.9-42.1-13-10.3-31.9-8.1-42.1 4.9-5.3 6.7-11.1 10.9-15.1 10.9-4.3 0-11.9-5.1-19.1-16.4-3.3-5.3-6.2-11.2-8.4-17.4h70.4c16.4 0 29.9-13.4 29.9-30zM401.6 704c-25.4 0-46.1-24.2-46.1-53.9 0-16.6-13.4-30-30-30s-30 13.4-30 30c0 62.8 47.6 113.9 106.1 113.9 16.6 0 30-13.4 30-30s-13.5-30-30-30z" fill="#33CC99" /></svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
3
|
+
<svg width="800px" height="800px" viewBox="0 0 1024 1024" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M861.9 383.8H218.1c-36.4 0-66.1-29.8-66.1-66.1V288c0-36.4 29.8-66.1 66.1-66.1h643.8c36.4 0 66.1 29.8 66.1 66.1v29.7c0 36.3-29.8 66.1-66.1 66.1z" fill="#FFB89A" /><path d="M822.9 129.2H199.8c-77.2 0-140.4 63.2-140.4 140.4v487.2c0 77.2 63.2 140.4 140.4 140.4h623.1c77.2 0 140.4-63.2 140.4-140.4V269.6c0-77.2-63.2-140.4-140.4-140.4z m80.4 177H760.4L864.6 201c5.4 3.3 10.4 7.3 15 11.8 15.3 15.3 23.7 35.4 23.7 56.8v36.6z m-673.3 0l104-117h61.3l-109.1 117H230z m247.4-117h169.2L532 306.2H368.3l109.1-117z m248.8 0h65.6L676 306.2h-60l112.5-114.8-2.3-2.2zM143 212.9c15.3-15.3 35.4-23.7 56.8-23.7h53.9l-104 117h-30.4v-36.5c0.1-21.4 8.5-41.5 23.7-56.8z m736.6 600.7c-15.3 15.3-35.4 23.7-56.8 23.7h-623c-21.3 0-41.5-8.4-56.8-23.7-15.3-15.3-23.7-35.4-23.7-56.8V366.2h783.9v390.6c0.1 21.3-8.3 41.5-23.6 56.8z" fill="#45484C" /><path d="M400.5 770.6V430.9L534.1 508c14.3 8.3 19.3 26.6 11 41-8.3 14.3-26.6 19.3-41 11l-43.6-25.2v131.8l114.1-65.9-7.5-4.3c-14.3-8.3-19.3-26.6-11-41 8.3-14.3 26.6-19.3 41-11l97.5 56.3-294.1 169.9z" fill="#33CC99" /></svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
3
|
+
<svg width="800px" height="800px" viewBox="0 0 1024 1024" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M188.3 766.5a94.4 135.8 0 1 0 188.8 0 94.4 135.8 0 1 0-188.8 0Z" fill="#FFB89A" /><path d="M931.5 397s0-0.1 0 0c-34.2-82.6-119.3-141-218.8-141-129.7 0-234.9 99.3-234.9 221.9 0 52.1 19.1 100.1 50.9 138 1 14.5 1.8 29.1 1.8 43.6 0 148.5 98.1 269 219.2 269 121 0 219.2-120.4 219.2-269 0-70.1-1.7-214.7-37.4-262.5z m-36.6 347.5c-8.7 25.3-21.1 47.9-36.8 67.1-29.8 36.5-68.3 56.7-108.5 56.7s-78.7-20.1-108.5-56.7c-15.7-19.2-28-41.8-36.8-67.1-9.3-26.9-13.9-55.5-13.9-85.1 0-16.8-1-33.5-2-47.7l-1.3-19.5-12.6-15c-24.1-28.6-36.8-63-36.8-99.3 0-89.3 78.5-161.9 174.9-161.9 36.4 0 71.4 10.3 101 29.7 28.4 18.7 65.5 81.7 65.5 81.7s17.9 27.5 24.7 98.2c4.5 46.5 5 95.9 5 133.8 0.1 29.6-4.6 58.2-13.9 85.1zM377.1 219.9c-51.8 0-93.8 42-93.8 93.8s42 93.8 93.8 93.8 93.8-42 93.8-93.8-42-93.8-93.8-93.8z m0 127.5c-18.6 0-33.8-15.2-33.8-33.8 0-18.6 15.2-33.8 33.8-33.8 18.6 0 33.8 15.2 33.8 33.8 0 18.7-15.1 33.8-33.8 33.8z" fill="#45484C" /><path d="M521.2 206.7m-50.3 0a50.3 50.3 0 1 0 100.6 0 50.3 50.3 0 1 0-100.6 0Z" fill="#45484C" /><path d="M653 156.4m-50.3 0a50.3 50.3 0 1 0 100.6 0 50.3 50.3 0 1 0-100.6 0Z" fill="#45484C" /><path d="M781.9 158.4m-50.3 0a50.3 50.3 0 1 0 100.6 0 50.3 50.3 0 1 0-100.6 0Z" fill="#45484C" /><path d="M909 206.7m-50.3 0a50.3 50.3 0 1 0 100.6 0 50.3 50.3 0 1 0-100.6 0Z" fill="#45484C" /><path d="M263.9 602.7c44.7 0 81 31.5 81 70.3 0 20.9-10.2 35.9-18.7 44.8l-15.9 19.7-0.5 27.2c0.7 7.2 0.6 16.9 0.6 24.7v4.8c0 33.7-27.4 61.2-61.2 61.2-14.9 0-33.3-9.6-48.1-25-15.2-15.9-24.6-35.9-24.6-52.3v-3.2c0-12.7 0-36.2 1-60.2 1.4-33 7.4-57.3 7.4-57.3 3.9-14.7 13.4-28.2 26.8-38 14.8-11 32.8-16.7 52.2-16.7m0-60c-66.4 0-122 42.4-137 99.4-10.9 23-10.4 112.6-10.4 135.9 0 66.9 65.8 137.3 132.7 137.3 66.9 0 121.2-54.3 121.2-121.2 0-9.2 0.3-23-0.8-34.9 22-23 35.4-53.2 35.4-86.3-0.1-71.9-63.2-130.2-141.1-130.2zM444.4 559.9c-26.4 0-47.8 21.4-47.8 47.8s21.4 47.8 47.8 47.8 47.8-21.4 47.8-47.8-21.4-47.8-47.8-47.8zM377.1 494.5c-15.2 0-27.5 12.3-27.5 27.5s12.3 27.5 27.5 27.5 27.5-12.3 27.5-27.5c0-15.3-12.3-27.5-27.5-27.5zM288.1 471.5c-15.2 0-27.5 12.3-27.5 27.5s12.3 27.5 27.5 27.5 27.5-12.3 27.5-27.5-12.4-27.5-27.5-27.5zM188.3 477.9c-15.2 0-27.5 12.3-27.5 27.5s12.3 27.5 27.5 27.5 27.5-12.3 27.5-27.5-12.3-27.5-27.5-27.5zM100.6 538.4c-15.2 0-27.5 12.3-27.5 27.5s12.3 27.5 27.5 27.5 27.5-12.3 27.5-27.5c-0.1-15.2-12.4-27.5-27.5-27.5z" fill="#45484C" /><path d="M670.1 584.6c-41.4 0-80.2-20.3-103.9-54.3-9.5-13.6-6.2-32.3 7.4-41.8 13.6-9.5 32.3-6.2 41.8 7.4 12.5 17.9 33 28.6 54.7 28.6 36.8 0 66.7-29.9 66.7-66.7 0-19.8-8.7-38.4-23.9-51.2-12.7-10.6-14.4-29.6-3.7-42.3s29.6-14.4 42.3-3.7c28.9 24.2 45.4 59.6 45.4 97.2-0.1 70-56.9 126.8-126.8 126.8z" fill="#33CC99" /><path d="M853 556.4c-26 0-49.6-14.5-60.1-36.9-7-15-0.6-32.9 14.4-39.9s32.9-0.6 39.9 14.4c0.3 0.6 2.2 2.4 5.8 2.4 1.2 0 2.3-0.2 3.3-0.6 15.5-5.9 32.8 1.8 38.7 17.3 5.9 15.5-1.8 32.8-17.3 38.7-7.9 3.1-16.2 4.6-24.7 4.6z" fill="#33CC99" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
praisonai/setup/build.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import sys
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
def build(setup_kwargs):
|
|
6
|
+
try:
|
|
7
|
+
# Get the directory of the current script
|
|
8
|
+
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
9
|
+
|
|
10
|
+
# Construct the path to post_install.py
|
|
11
|
+
post_install_script = os.path.join(script_dir, 'post_install.py')
|
|
12
|
+
|
|
13
|
+
# Run the post_install.py script
|
|
14
|
+
subprocess.check_call([sys.executable, post_install_script])
|
|
15
|
+
except subprocess.CalledProcessError as e:
|
|
16
|
+
print(f"Error occurred while running the post-install script: {e}")
|
|
17
|
+
sys.exit(1)
|
|
18
|
+
return setup_kwargs
|
|
19
|
+
|
|
20
|
+
if __name__ == "__main__":
|
|
21
|
+
build({})
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
ollama_save: "true"
|
|
2
|
+
huggingface_save: "true"
|
|
3
|
+
train: "true"
|
|
4
|
+
|
|
5
|
+
model_name: "unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit"
|
|
6
|
+
hf_model_name: "mervinpraison/llama-3.1-tamilan-8B-test"
|
|
7
|
+
ollama_model: "mervinpraison/llama3.1-tamilan-test"
|
|
8
|
+
model_parameters: "8b"
|
|
9
|
+
|
|
10
|
+
max_seq_length: 2048
|
|
11
|
+
load_in_4bit: true
|
|
12
|
+
lora_r: 16
|
|
13
|
+
lora_target_modules:
|
|
14
|
+
- "q_proj"
|
|
15
|
+
- "k_proj"
|
|
16
|
+
- "v_proj"
|
|
17
|
+
- "o_proj"
|
|
18
|
+
- "gate_proj"
|
|
19
|
+
- "up_proj"
|
|
20
|
+
- "down_proj"
|
|
21
|
+
lora_alpha: 16
|
|
22
|
+
lora_dropout: 0
|
|
23
|
+
lora_bias: "none"
|
|
24
|
+
use_gradient_checkpointing: "unsloth"
|
|
25
|
+
random_state: 3407
|
|
26
|
+
use_rslora: false
|
|
27
|
+
loftq_config: null
|
|
28
|
+
|
|
29
|
+
dataset:
|
|
30
|
+
- name: "yahma/alpaca-cleaned"
|
|
31
|
+
split_type: "train"
|
|
32
|
+
processing_func: "format_prompts"
|
|
33
|
+
rename:
|
|
34
|
+
input: "input"
|
|
35
|
+
output: "output"
|
|
36
|
+
instruction: "instruction"
|
|
37
|
+
filter_data: false
|
|
38
|
+
filter_column_value: "id"
|
|
39
|
+
filter_value: "alpaca"
|
|
40
|
+
num_samples: 20000
|
|
41
|
+
|
|
42
|
+
dataset_text_field: "text"
|
|
43
|
+
dataset_num_proc: 2
|
|
44
|
+
packing: false
|
|
45
|
+
|
|
46
|
+
per_device_train_batch_size: 2
|
|
47
|
+
gradient_accumulation_steps: 2
|
|
48
|
+
warmup_steps: 5
|
|
49
|
+
num_train_epochs: 1
|
|
50
|
+
max_steps: 10
|
|
51
|
+
learning_rate: 2.0e-4
|
|
52
|
+
logging_steps: 1
|
|
53
|
+
optim: "adamw_8bit"
|
|
54
|
+
weight_decay: 0.01
|
|
55
|
+
lr_scheduler_type: "linear"
|
|
56
|
+
seed: 3407
|
|
57
|
+
output_dir: "outputs"
|
|
58
|
+
|
|
59
|
+
quantization_method:
|
|
60
|
+
- "q4_k_m"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import subprocess
|
|
4
|
+
import logging
|
|
5
|
+
|
|
6
|
+
def install_playwright():
|
|
7
|
+
"""Install playwright browsers."""
|
|
8
|
+
try:
|
|
9
|
+
subprocess.run([sys.executable, "-m", "playwright", "install"], check=True)
|
|
10
|
+
logging.info("Playwright browsers installed successfully")
|
|
11
|
+
except subprocess.CalledProcessError as e:
|
|
12
|
+
logging.error(f"Failed to install playwright browsers: {e}")
|
|
13
|
+
except Exception as e:
|
|
14
|
+
logging.error(f"Unexpected error installing playwright browsers: {e}")
|
|
15
|
+
|
|
16
|
+
def main():
|
|
17
|
+
"""Post-installation script."""
|
|
18
|
+
# Check if this is a chat or code installation
|
|
19
|
+
if any(extra in sys.argv for extra in ['chat', 'code']):
|
|
20
|
+
install_playwright()
|
|
21
|
+
|
|
22
|
+
if __name__ == "__main__":
|
|
23
|
+
main()
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
import platform
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
8
|
+
script_path = os.path.join(script_dir, 'setup_conda_env.sh')
|
|
9
|
+
|
|
10
|
+
if platform.system() == 'Windows':
|
|
11
|
+
print("Windows detected. Please run the setup_conda_env.sh script manually in Git Bash or WSL.")
|
|
12
|
+
print(f"Script location: {script_path}")
|
|
13
|
+
sys.exit(1)
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
subprocess.check_call(['bash', script_path])
|
|
17
|
+
except subprocess.CalledProcessError as e:
|
|
18
|
+
print(f"Error occurred while running the setup script: {e}")
|
|
19
|
+
print("Setup failed. Please check the error message above and try to resolve the issue.")
|
|
20
|
+
sys.exit(1)
|
|
21
|
+
|
|
22
|
+
print("Conda environment setup completed successfully!")
|
|
23
|
+
|
|
24
|
+
if __name__ == "__main__":
|
|
25
|
+
main()
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Detect OS and architecture
|
|
4
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
5
|
+
# macOS
|
|
6
|
+
if [[ $(uname -m) == 'arm64' ]]; then
|
|
7
|
+
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh"
|
|
8
|
+
else
|
|
9
|
+
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh"
|
|
10
|
+
fi
|
|
11
|
+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
12
|
+
# Linux
|
|
13
|
+
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"
|
|
14
|
+
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
|
|
15
|
+
# Windows
|
|
16
|
+
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe"
|
|
17
|
+
echo "Windows detected. Please run this script in Git Bash or WSL."
|
|
18
|
+
exit 1
|
|
19
|
+
else
|
|
20
|
+
echo "Unsupported operating system: $OSTYPE"
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# Check if conda is already installed
|
|
25
|
+
if ! command -v conda &> /dev/null; then
|
|
26
|
+
echo "Conda is not installed. Installing Miniconda..."
|
|
27
|
+
wget $MINICONDA_URL -O ~/miniconda.sh
|
|
28
|
+
bash ~/miniconda.sh -b -p $HOME/miniconda
|
|
29
|
+
source $HOME/miniconda/bin/activate
|
|
30
|
+
conda init
|
|
31
|
+
else
|
|
32
|
+
echo "Conda is already installed."
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Create and activate the Conda environment
|
|
36
|
+
ENV_NAME="praison_env"
|
|
37
|
+
if conda info --envs | grep -q $ENV_NAME; then
|
|
38
|
+
echo "Environment $ENV_NAME already exists. Recreating..."
|
|
39
|
+
conda env remove -y -n $ENV_NAME # Remove existing environment
|
|
40
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
41
|
+
# macOS (both Intel and M1/M2)
|
|
42
|
+
conda create --name $ENV_NAME python=3.10 pytorch=2.3.0 -c pytorch -y
|
|
43
|
+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
44
|
+
# Linux
|
|
45
|
+
conda create --name $ENV_NAME python=3.10 pytorch=2.3.0 cudatoolkit=11.8 -c pytorch -c nvidia -y
|
|
46
|
+
fi
|
|
47
|
+
# conda activate $ENV_NAME
|
|
48
|
+
else
|
|
49
|
+
echo "Creating new environment $ENV_NAME..."
|
|
50
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
51
|
+
# macOS (both Intel and M1/M2)
|
|
52
|
+
conda create --name $ENV_NAME python=3.10 pytorch=2.3.0 -c pytorch -y
|
|
53
|
+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
54
|
+
# Linux
|
|
55
|
+
conda create --name $ENV_NAME python=3.10 pytorch=2.3.0 cudatoolkit=11.8 -c pytorch -c nvidia -y
|
|
56
|
+
fi
|
|
57
|
+
# conda activate $ENV_NAME
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# source $HOME/miniconda/bin/activate $ENV_NAME
|
|
61
|
+
|
|
62
|
+
# Get full path of pip
|
|
63
|
+
PIP_FULL_PATH=$(conda run -n $ENV_NAME which pip)
|
|
64
|
+
|
|
65
|
+
# Install other packages within the activated environment
|
|
66
|
+
# Use PIP_FULL_PATH to run pip commands
|
|
67
|
+
$PIP_FULL_PATH install --upgrade pip
|
|
68
|
+
$PIP_FULL_PATH install "xformers==0.0.26.post1"
|
|
69
|
+
$PIP_FULL_PATH install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git@4e570be9ae4ced8cdc64e498125708e34942befc"
|
|
70
|
+
$PIP_FULL_PATH install --no-deps "trl<0.9.0" peft accelerate bitsandbytes
|
|
71
|
+
|
|
72
|
+
echo "Setup completed successfully!"
|
praisonai/setup.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
from setuptools.command.install import install
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
class PostInstallCommand(install):
|
|
7
|
+
def run(self):
|
|
8
|
+
install.run(self)
|
|
9
|
+
# Install Playwright browsers
|
|
10
|
+
subprocess.check_call([sys.executable, '-m', 'playwright', 'install'])
|
|
11
|
+
|
|
12
|
+
setup(
|
|
13
|
+
cmdclass={
|
|
14
|
+
'install': PostInstallCommand,
|
|
15
|
+
}
|
|
16
|
+
)
|