Last active
June 21, 2023 23:52
-
-
Save michael-erasmus/bd117e1959712ac3a40c1db4d056a1ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get start time in seconds since the epoch | |
start=$(date +%s) | |
# Run chatblade | |
output=$(chatblade -c 4 write a poem) | |
# Get end time in seconds since the epoch | |
end=$(date +%s) | |
# Calculate duration | |
duration=$((end - start)) | |
# Count tokens using ttok | |
token_count=$(echo "$output" | ttok) # count the tokens | |
# Print token count and duration for debugging | |
echo "Token count: $token_count" | |
echo "Duration: $duration seconds" | |
# Calculate tokens per second | |
tps=$(echo "scale=2; $token_count / $duration" | bc) | |
echo "Tokens per second: $tps" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ ./calculate-tps.sh | |
Token count: 449 | |
Duration: 46 seconds | |
Tokens per second: 9.76 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ ./calculate-tps.sh | |
Token count: 461 | |
Duration: 48 seconds | |
Tokens per second: 9.60 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ ./calculate-tps.sh | |
Token count: 450 | |
Duration: 52 seconds | |
Tokens per second: 8.65 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ ./calculate-tps.sh | |
Token count: 504 | |
Duration: 53 seconds | |
Tokens per second: 9.50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment