pycoze 0.1.89__tar.gz → 0.1.90__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pycoze-0.1.89 → pycoze-0.1.90}/PKG-INFO +1 -1
- pycoze-0.1.90/pycoze/ai/__init__.py +1 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/ai/vram_reserve.py +3 -11
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze.egg-info/PKG-INFO +1 -1
- {pycoze-0.1.89 → pycoze-0.1.90}/setup.py +1 -1
- pycoze-0.1.89/pycoze/ai/__init__.py +0 -1
- {pycoze-0.1.89 → pycoze-0.1.90}/LICENSE +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/README.md +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/__init__.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/access/__init__.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/access/tool_for_bot.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/bot/__init__.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/bot/agent/__init__.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/bot/agent/agent.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/bot/agent/agent_types/__init__.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/bot/agent/agent_types/openai_func_call_agent.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/bot/agent/assistant.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/bot/agent/chat.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/bot/bot.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/module.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/ui/__init__.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/ui/base.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/ui/color.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/ui/typ.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/ui/ui_def.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/utils/__init__.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/utils/arg.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze/utils/text_or_file.py +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze.egg-info/SOURCES.txt +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze.egg-info/dependency_links.txt +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/pycoze.egg-info/top_level.txt +0 -0
- {pycoze-0.1.89 → pycoze-0.1.90}/setup.cfg +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
from .vram_reserve import reserve_vram, reserve_vram_retry, unreserve_vram
|
@@ -88,33 +88,25 @@ def reserve_vram_retry(gb, retry=None, uid=None):
|
|
88
88
|
retry = sys.maxsize
|
89
89
|
for i in range(retry):
|
90
90
|
time.sleep(1)
|
91
|
-
if i % 10 == 0 or i < 10:
|
91
|
+
if i % 10 == 0 or i < 10 and i != 0:
|
92
92
|
print(f"重试第{i}次")
|
93
93
|
if reserve_vram(gb, uid):
|
94
94
|
return True
|
95
95
|
return False
|
96
96
|
|
97
97
|
|
98
|
-
def
|
98
|
+
def unreserve_vram(uid=None):
|
99
99
|
if uid is None:
|
100
100
|
uid = f"pid:{os.getpid()}"
|
101
101
|
with sqlite3.connect(DATABASE_PATH) as conn:
|
102
102
|
cursor = conn.cursor()
|
103
103
|
cursor.execute(f"DELETE FROM {TABLE_NAME} WHERE uid = ?", (uid,))
|
104
104
|
conn.commit()
|
105
|
-
# 计算释放后的剩余VRAM大小
|
106
|
-
cursor.execute(f"SELECT SUM(reserved_gb) FROM {TABLE_NAME}")
|
107
|
-
total_reserved = cursor.fetchone()[0]
|
108
|
-
if total_reserved is None:
|
109
|
-
total_reserved = 0.0
|
110
|
-
available_gb = get_vram_resources() - total_reserved
|
111
|
-
print(f"释放成功,剩余VRAM大小: {available_gb} GB")
|
112
105
|
|
113
106
|
|
114
107
|
# 注册退出时的清理函数
|
115
108
|
def cleanup():
|
116
|
-
|
117
|
-
print("程序退出,VRAM资源已释放")
|
109
|
+
unreserve_vram()
|
118
110
|
|
119
111
|
|
120
112
|
def initialize_and_check():
|
@@ -1 +0,0 @@
|
|
1
|
-
from .vram_reserve import reserve_vram_retry, release_vram, reserve_vram
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|