Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f3ab7a8

Browse filesBrowse files
author
Andi Soe
committed
0.2.90 backport to python 3.7
1 parent d981d32 commit f3ab7a8
Copy full SHA for f3ab7a8

File tree

Expand file treeCollapse file tree

10 files changed

+152
-150
lines changed
Filter options
Expand file treeCollapse file tree

10 files changed

+152
-150
lines changed

‎examples/low_level_api/common.py

Copy file name to clipboardExpand all lines: examples/low_level_api/common.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import re
44

55
from dataclasses import dataclass, field
6-
from typing import List
6+
from typing import List, Dict
77

88
# Based on https://github.com/ggerganov/llama.cpp/blob/master/examples/common.cpp
99

@@ -19,7 +19,7 @@ class GptParams:
1919
n_keep: int = 0
2020

2121
ignore_eos: bool = False
22-
logit_bias: dict[int, float] = field(default_factory=dict)
22+
logit_bias: Dict[int, float] = field(default_factory=dict)
2323
top_k: int = 40
2424
top_p: float = 0.95
2525
tfs_z: float = 1.00
@@ -380,7 +380,8 @@ def gpt_params_parse(argv=None):
380380

381381
if logit_bias_str != None:
382382
for i in logit_bias_str:
383-
if m := re.match(r"(\d+)([-+]\d+)", i):
383+
m = re.match(r"(\d+)([-+]\d+)", i)
384+
if m:
384385
params.logit_bias[int(m.group(1))] = float(m.group(2))
385386

386387
return params

‎examples/low_level_api/low_level_api_chat_cpp.py

Copy file name to clipboardExpand all lines: examples/low_level_api/low_level_api_chat_cpp.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,8 @@ def output(self):
688688
# read user input
689689
def read_input(self):
690690
out = ""
691-
while (t := input()).endswith("\\"):
691+
t = input()
692+
while t.endswith("\\"):
692693
out += t[:-1] + "\n"
693694
return out + t + "\n"
694695

‎llama_cpp/llama.py

Copy file name to clipboardExpand all lines: llama_cpp/llama.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from typing import (
1616
Any,
1717
List,
18-
Literal,
1918
Optional,
2019
Union,
2120
Generator,
@@ -25,6 +24,7 @@
2524
Callable,
2625
Dict,
2726
)
27+
from typing_extensions import Literal
2828
from collections import deque
2929
from pathlib import Path
3030

‎llama_cpp/llama_chat_format.py

Copy file name to clipboardExpand all lines: llama_cpp/llama_chat_format.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
Dict,
1515
Iterator,
1616
List,
17-
Literal,
1817
Optional,
1918
Tuple,
2019
Union,
21-
Protocol,
2220
cast,
2321
)
22+
from typing_extensions import Literal, Protocol
2423

2524
import jinja2
2625
from jinja2.sandbox import ImmutableSandboxedEnvironment

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.