Skip to content

Commit f4768a9

Browse files
Update generative-proof-of-concept-CPU-preprocessing-in-memory.py
Add debug prints to introspect sampling.
1 parent 9aabc74 commit f4768a9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

generative-proof-of-concept-CPU-preprocessing-in-memory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,7 @@ def generate(self,
931931
probs = tf.where(top_k_mask, probs, tf.zeros_like(probs))
932932
# Renormalize
933933
probs = probs / tf.reduce_sum(probs)
934+
print(f">>> After top_k: {tf.shape(probs)} shape, {tf.reduce_sum(tf.cast(probs > 1e-8, tf.int32))} non-zero probs")
934935

935936
# Apply top-p filtering (if specified)
936937
if top_p is not None and top_p < 1.0:
@@ -953,6 +954,7 @@ def generate(self,
953954
# Apply mask and renormalize
954955
probs = tf.where(filter_mask, probs, tf.zeros_like(probs))
955956
probs = probs / tf.reduce_sum(probs)
957+
print(f">>> After top_p: {tf.shape(probs)} shape, {tf.reduce_sum(tf.cast(probs > 1e-8, tf.int32))} non-zero probs")
956958

957959
# Sample from the final filtered distribution
958960
# Get non-zero indices and their probabilities

0 commit comments

Comments
 (0)