gptmodel 1.0.4__py3-none-any.whl → 1.0.6__py3-none-any.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.
- gptmodel/gptmodel.py +5 -3
- {gptmodel-1.0.4.dist-info → gptmodel-1.0.6.dist-info}/METADATA +3 -3
- gptmodel-1.0.6.dist-info/RECORD +7 -0
- gptmodel-1.0.4.dist-info/RECORD +0 -7
- {gptmodel-1.0.4.dist-info → gptmodel-1.0.6.dist-info}/LICENSE.txt +0 -0
- {gptmodel-1.0.4.dist-info → gptmodel-1.0.6.dist-info}/WHEEL +0 -0
- {gptmodel-1.0.4.dist-info → gptmodel-1.0.6.dist-info}/top_level.txt +0 -0
gptmodel/gptmodel.py
CHANGED
@@ -372,7 +372,9 @@ class GPTModel:
|
|
372
372
|
else: directory, file_name = str(model_path), 'model.gpt'
|
373
373
|
model_file = self.__os_path.join(directory, file_name)
|
374
374
|
if progress:
|
375
|
-
for _ in self.__tqdm(range(10), desc='Loading model', leave=False):
|
375
|
+
for _ in self.__tqdm(range(10), desc='Loading model', leave=False):
|
376
|
+
try: checkpoint = self.__load(model_file, map_location=self.__device)
|
377
|
+
except: checkpoint = self.__load(model_file)
|
376
378
|
else: checkpoint = self.__load(model_file, map_location=self.__device)
|
377
379
|
try: self.__tokenizer = str(checkpoint['tokenizer']).lower().strip()
|
378
380
|
except: self.__tokenizer = 'gpt'
|
@@ -445,7 +447,7 @@ class GPTModel:
|
|
445
447
|
max_tokens = max((1, int(max_tokens))) if type(max_tokens) in (bool, int, float) else 500
|
446
448
|
temperature = max((0, float(temperature))) if type(temperature) in (bool, int, float) else 0.5
|
447
449
|
top_k = max((0, int(top_k))) if type(top_k) in (bool, int, float) else 0
|
448
|
-
top_p = min((1.0, max((0.0,
|
450
|
+
top_p = min((1.0, max((0.0, float(top_p))))) if type(top_p) in (bool, int, float) else 1.0
|
449
451
|
stream = bool(stream) if type(stream) in (bool, int, float) else False
|
450
452
|
if self.__model is None: raise ValueError('Model is not initialized. Call train or loadModel first.')
|
451
453
|
if stream: return self.__generate_tokens(prompt=prompt, max_tokens=max_tokens, temperature=temperature, top_k=top_k, top_p=top_p)
|
@@ -460,7 +462,7 @@ class GPTModel:
|
|
460
462
|
max_tokens = max((1, int(max_tokens))) if type(max_tokens) in (bool, int, float) else 500
|
461
463
|
temperature = max((0, float(temperature))) if type(temperature) in (bool, int, float) else 0.5
|
462
464
|
top_k = max((0, int(top_k))) if type(top_k) in (bool, int, float) else 0
|
463
|
-
top_p = min((1.0, max((0.0,
|
465
|
+
top_p = min((1.0, max((0.0, float(top_p))))) if type(top_p) in (bool, int, float) else 1.0
|
464
466
|
stream = bool(stream) if type(stream) in (bool, int, float) else False
|
465
467
|
if self.__model is None: raise ValueError('Model is not initialized. Call train or loadModel first.')
|
466
468
|
if stream:
|
@@ -1,14 +1,14 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: gptmodel
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.6
|
4
4
|
Home-page: https://github.com/sapiens-technology/gptmodel
|
5
5
|
Author: SAPIENS TECHNOLOGY
|
6
6
|
License: Proprietary Software
|
7
7
|
License-File: LICENSE.txt
|
8
|
-
Requires-Dist: tqdm==4.67.1
|
9
|
-
Requires-Dist: numpy==1.25.2
|
10
8
|
Requires-Dist: torch==2.4.1
|
9
|
+
Requires-Dist: numpy==1.25.2
|
11
10
|
Requires-Dist: tiktoken==0.4.0
|
11
|
+
Requires-Dist: tqdm==4.67.1
|
12
12
|
Dynamic: author
|
13
13
|
Dynamic: home-page
|
14
14
|
Dynamic: license
|
@@ -0,0 +1,7 @@
|
|
1
|
+
gptmodel/__init__.py,sha256=ifnJnBPHcBZwiHgt_mNp9gd1OJYCCHB3bgml6TmKBIw,1358
|
2
|
+
gptmodel/gptmodel.py,sha256=rJqV2Pbk7lRati9sqj4hEHUyqPFfjQu6eWYkq4T2sPw,33508
|
3
|
+
gptmodel-1.0.6.dist-info/LICENSE.txt,sha256=WqB2vIA5tH5lqLTr53yT_oy1m0wYfuvCPQKxdDHWimg,115
|
4
|
+
gptmodel-1.0.6.dist-info/METADATA,sha256=oUIv3Mn6VM2SgqLQ6xLv6F95nsfOrNBFWQ_nLCK8B-c,384
|
5
|
+
gptmodel-1.0.6.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
6
|
+
gptmodel-1.0.6.dist-info/top_level.txt,sha256=585C0QclguIkVPKKPpoeD2FxYAc5n5EAuvJNK4vMeQk,9
|
7
|
+
gptmodel-1.0.6.dist-info/RECORD,,
|
gptmodel-1.0.4.dist-info/RECORD
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
gptmodel/__init__.py,sha256=ifnJnBPHcBZwiHgt_mNp9gd1OJYCCHB3bgml6TmKBIw,1358
|
2
|
-
gptmodel/gptmodel.py,sha256=3qbXbCEkXSsakFAuLu6RCacyHhdu9nIHagNriEi9NEE,33414
|
3
|
-
gptmodel-1.0.4.dist-info/LICENSE.txt,sha256=WqB2vIA5tH5lqLTr53yT_oy1m0wYfuvCPQKxdDHWimg,115
|
4
|
-
gptmodel-1.0.4.dist-info/METADATA,sha256=23KkOothlS852QRWKN6xP7BrKj1cLh0SQ723fet3Mps,384
|
5
|
-
gptmodel-1.0.4.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
6
|
-
gptmodel-1.0.4.dist-info/top_level.txt,sha256=585C0QclguIkVPKKPpoeD2FxYAc5n5EAuvJNK4vMeQk,9
|
7
|
-
gptmodel-1.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|