pycoze 0.1.89__py3-none-any.whl → 0.1.90__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
pycoze/ai/__init__.py CHANGED
@@ -1 +1 @@
1
- from .vram_reserve import reserve_vram_retry, release_vram, reserve_vram
1
+ from .vram_reserve import reserve_vram, reserve_vram_retry, unreserve_vram
pycoze/ai/vram_reserve.py CHANGED
@@ -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 release_vram(uid=None):
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
- release_vram()
117
- print("程序退出,VRAM资源已释放")
109
+ unreserve_vram()
118
110
 
119
111
 
120
112
  def initialize_and_check():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.89
3
+ Version: 0.1.90
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -2,8 +2,8 @@ pycoze/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  pycoze/module.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  pycoze/access/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  pycoze/access/tool_for_bot.py,sha256=Nv6XlxcqaLaMVQNDkpcthlqaSxyfHoOfWiTScQXO22Y,2656
5
- pycoze/ai/__init__.py,sha256=Smivpb8qbRnzWkzKRe2IxsmKP5Dh8EvngDFdkD_DVLo,73
6
- pycoze/ai/vram_reserve.py,sha256=zjRFxTJDfWlyd3xSJTkB4sdfsahsOijyCY_MEIotMbw,4731
5
+ pycoze/ai/__init__.py,sha256=odM2lgYSnApxw4AzLV_5AyaxL5_MLfydOSB1VmLGFyA,75
6
+ pycoze/ai/vram_reserve.py,sha256=QbqaA8qv87cnEpOVDMygi0BNMxuhLYwj1UKfR_D5BD4,4340
7
7
  pycoze/bot/__init__.py,sha256=6HHMxDQVOyZM9dtSjQm9tjGnhj4h7CixD0JOvEwTi48,41
8
8
  pycoze/bot/bot.py,sha256=w_ddp3IeWryUgIad-_V-SsDzGwYqZXekw5NXbYyXrkk,3041
9
9
  pycoze/bot/agent/__init__.py,sha256=YR9vpkEQn1e4937r_xFPJXUCPBEJ0SFzEQDBe2x3-YA,157
@@ -20,8 +20,8 @@ pycoze/ui/ui_def.py,sha256=UhhU_yB3GV9ISbvTWT48hsHPHI250BhMILh6bu5Uioo,4206
20
20
  pycoze/utils/__init__.py,sha256=TNJhFfY7JYdLlzuP9GvgxfNXUtbgH_NUUJSqHXCxJn4,78
21
21
  pycoze/utils/arg.py,sha256=kA3KBQzXc2WlH5XbF8kfikfpqljiKaW7oY_GE4Qyffc,753
22
22
  pycoze/utils/text_or_file.py,sha256=gpxZVWt2DW6YiEg_MnMuwg36VNf3TX383QD_1oZNB0Y,551
23
- pycoze-0.1.89.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
24
- pycoze-0.1.89.dist-info/METADATA,sha256=vpuL_fkJtMzFx7So1MwT3eftwVbeRMQdYnNQJ96Ecbk,719
25
- pycoze-0.1.89.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
26
- pycoze-0.1.89.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
27
- pycoze-0.1.89.dist-info/RECORD,,
23
+ pycoze-0.1.90.dist-info/LICENSE,sha256=QStd_Qsd0-kAam_-sOesCIp_uKrGWeoKwt9M49NVkNU,1090
24
+ pycoze-0.1.90.dist-info/METADATA,sha256=zoj2vDA5bs0HUR12_2UExkLzufmpRv_srUQ2UUu_c2s,719
25
+ pycoze-0.1.90.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
26
+ pycoze-0.1.90.dist-info/top_level.txt,sha256=76dPeDhKvOCleL3ZC5gl1-y4vdS1tT_U1hxWVAn7sFo,7
27
+ pycoze-0.1.90.dist-info/RECORD,,