Skip to content

Commit e7dc4b8

Browse files
committed
Merge branch 'main' into ppdl-01
Signed-off-by: Louis Mandel <[email protected]>
2 parents 1746d20 + 8e1224e commit e7dc4b8

File tree

4 files changed

+45
-16
lines changed

4 files changed

+45
-16
lines changed

pdl-live-react/package-lock.json

Lines changed: 20 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pdl-live-react/src-tauri/Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pdl-live-react/src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ schemars = "0.8.22"
5151
fs4 = "0.13.1"
5252
derive_builder = "0.20.2"
5353
iana-time-zone = "0.1.63"
54-
async-openai = "0.29.0"
54+
async-openai = "0.30.0"
5555
regex = "1.11.1"
5656

5757
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]

src/pdl/pdl_stdlib.pdl

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,38 @@ defs:
3838
else:
3939
lp_n = lp_evaluation
4040
other = 'true'
41-
if evaluation in contents_keys:
41+
42+
if other in contents_keys:
4243
exact_match = True
4344
else:
4445
exact_match = False
4546

47+
lp_other = -math.inf
4648
for tp in top_logprobs:
4749
if match(other, tp['token'], exact_match):
4850
lp_other = tp['logprob']
4951
break
5052

53+
# if math.isinf(lp_other):
54+
# print("XXXXXXXXXXXXXXXXXXXXXXXXXXXX")
55+
# print("XXXX lp_other is not defined")
56+
# print(f"{evaluation=}")
57+
# print(f"{other=}")
58+
# print(f"{exact_match=}")
59+
# print(f"top_logprobs tokens:")
60+
# for tp in top_logprobs:
61+
# print(f" {tp['token']}")
62+
# print("XXXXXXXXXXXXXXXXXXXXXXXXXXXX")
63+
5164
if other == 'true':
5265
lp_y = lp_other
5366
else:
5467
lp_n = lp_other
5568

56-
result = math.log(math.exp(lp_y) / (math.exp(lp_y) + math.exp(lp_n)))
57-
58-
# print(f"XXXX { result= } ({math.exp(result)})")
59-
69+
if math.exp(lp_y) == 0.0:
70+
result = -math.inf
71+
else:
72+
result = math.log(math.exp(lp_y) / (math.exp(lp_y) + math.exp(lp_n)))
6073

6174
# print(f"evaluation: { evaluation }")
6275
# print(f"exact_match: { exact_match }")

0 commit comments

Comments
 (0)