Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server: clean up json_value() function #7142

Merged
merged 1 commit into from
May 8, 2024

Conversation

ngxson
Copy link
Collaborator

@ngxson ngxson commented May 8, 2024

Just a small clean up code style

  • macro NLOHMANN_JSON_NAMESPACE is used instead of hard-coding version number
  • json(default_value).type_name() will return full type name, for example "boolean" instead of "b"
  • Because we already check body.contains, there is no need to repeat default value

@ngxson ngxson requested a review from phymbert May 8, 2024 09:48
Copy link
Contributor

github-actions bot commented May 8, 2024

📈 llama.cpp server for bench-server-baseline on Standard_NC4as_T4_v3 for phi-2-q4_0: 550 iterations 🚀

Expand details for performance related PR only
  • Concurrent users: 8, duration: 10m
  • HTTP request : avg=8509.22ms p(95)=20620.45ms fails=, finish reason: stop=485 truncated=65
  • Prompt processing (pp): avg=93.7tk/s p(95)=454.97tk/s
  • Token generation (tg): avg=38.39tk/s p(95)=47.6tk/s
  • ggml-org/models/phi-2/ggml-model-q4_0.gguf parallel=8 ctx-size=16384 ngl=33 batch-size=2048 ubatch-size=256 pp=1024 pp+tg=2048 branch=xsn/better_server_json_value commit=cb46be7061a2d81e40607c46ed9c76c990669413

prompt_tokens_seconds

More
---
config:
    xyChart:
        titleFontSize: 12
        width: 900
        height: 600
    themeVariables:
        xyChart:
            titleColor: "#000000"
---
xychart-beta
    title "llama.cpp bench-server-baseline on Standard_NC4as_T4_v3
 duration=10m 550 iterations"
    y-axis "llamacpp:prompt_tokens_seconds"
    x-axis "llamacpp:prompt_tokens_seconds" 1715162773 --> 1715163401
    line [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 308.61, 308.61, 308.61, 308.61, 308.61, 446.67, 446.67, 446.67, 446.67, 446.67, 452.48, 452.48, 452.48, 452.48, 452.48, 478.19, 478.19, 478.19, 478.19, 478.19, 558.22, 558.22, 558.22, 558.22, 558.22, 583.11, 583.11, 583.11, 583.11, 583.11, 584.75, 584.75, 584.75, 584.75, 584.75, 611.76, 611.76, 611.76, 611.76, 611.76, 637.66, 637.66, 637.66, 637.66, 637.66, 656.07, 656.07, 656.07, 656.07, 656.07, 659.74, 659.74, 659.74, 659.74, 659.74, 686.27, 686.27, 686.27, 686.27, 686.27, 736.26, 736.26, 736.26, 736.26, 736.26, 772.61, 772.61, 772.61, 772.61, 772.61, 741.74, 741.74, 741.74, 741.74, 741.74, 757.02, 757.02, 757.02, 757.02, 757.02, 758.88, 758.88, 758.88, 758.88, 758.88, 783.92, 783.92, 783.92, 783.92, 783.92, 786.37, 786.37, 786.37, 786.37, 786.37, 787.78, 787.78, 787.78, 787.78, 787.78, 795.17, 795.17, 795.17, 795.17, 795.17, 798.47, 798.47, 798.47, 798.47, 798.47, 803.32, 803.32, 803.32, 803.32, 803.32, 806.43, 806.43, 806.43, 806.43, 806.43, 806.11, 806.11, 806.11, 806.11, 806.11, 802.39, 802.39, 802.39, 802.39, 802.39, 805.91, 805.91, 805.91, 805.91, 805.91, 804.92, 804.92, 804.92, 804.92, 804.92, 805.94, 805.94, 805.94, 805.94, 805.94, 812.27, 812.27, 812.27, 812.27, 812.27, 812.59, 812.59, 812.59, 812.59, 812.59, 813.09, 813.09, 813.09, 813.09, 813.09, 814.47, 814.47, 814.47, 814.47, 814.47, 828.17, 828.17, 828.17, 828.17, 828.17, 835.1, 835.1, 835.1, 835.1, 835.1, 833.88, 833.88, 833.88, 833.88, 833.88, 829.18, 829.18, 829.18, 829.18, 829.18, 828.85, 828.85, 828.85, 828.85, 828.85, 828.34, 828.34, 828.34, 828.34, 828.34, 828.77, 828.77, 828.77, 828.77, 828.77, 829.07, 829.07, 829.07, 829.07, 829.07, 838.59, 838.59, 838.59, 838.59, 838.59, 812.83, 812.83, 812.83, 812.83, 812.83, 812.33, 812.33, 812.33, 812.33, 812.33, 810.86, 810.86, 810.86, 810.86, 810.86, 808.82, 808.82, 808.82, 808.82, 808.82, 814.16, 814.16, 814.16, 814.16, 814.16, 817.04, 817.04, 817.04, 817.04, 817.04, 818.32, 818.32, 818.32, 818.32, 818.32, 822.84, 822.84, 822.84, 822.84, 822.84, 825.84, 825.84, 825.84, 825.84, 825.84, 830.77, 830.77, 830.77, 830.77, 830.77, 830.09, 830.09, 830.09, 830.09, 830.09, 831.93, 831.93, 831.93, 831.93, 831.93, 831.18, 831.18, 831.18, 831.18, 831.18, 832.62, 832.62, 832.62, 832.62, 832.62, 834.6, 834.6, 834.6, 834.6, 834.6, 834.25, 834.25, 834.25, 834.25, 834.25, 836.28, 836.28, 836.28, 836.28, 836.28, 839.24, 839.24, 839.24, 839.24, 839.24, 839.36, 839.36, 839.36, 839.36, 839.36]
                    
Loading
predicted_tokens_seconds
More
---
config:
    xyChart:
        titleFontSize: 12
        width: 900
        height: 600
    themeVariables:
        xyChart:
            titleColor: "#000000"
---
xychart-beta
    title "llama.cpp bench-server-baseline on Standard_NC4as_T4_v3
 duration=10m 550 iterations"
    y-axis "llamacpp:predicted_tokens_seconds"
    x-axis "llamacpp:predicted_tokens_seconds" 1715162773 --> 1715163401
    line [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 42.53, 42.53, 42.53, 42.53, 42.53, 43.07, 43.07, 43.07, 43.07, 43.07, 36.7, 36.7, 36.7, 36.7, 36.7, 32.85, 32.85, 32.85, 32.85, 32.85, 32.81, 32.81, 32.81, 32.81, 32.81, 33.05, 33.05, 33.05, 33.05, 33.05, 33.32, 33.32, 33.32, 33.32, 33.32, 34.05, 34.05, 34.05, 34.05, 34.05, 34.34, 34.34, 34.34, 34.34, 34.34, 34.61, 34.61, 34.61, 34.61, 34.61, 34.41, 34.41, 34.41, 34.41, 34.41, 34.0, 34.0, 34.0, 34.0, 34.0, 33.22, 33.22, 33.22, 33.22, 33.22, 33.14, 33.14, 33.14, 33.14, 33.14, 32.75, 32.75, 32.75, 32.75, 32.75, 31.81, 31.81, 31.81, 31.81, 31.81, 32.12, 32.12, 32.12, 32.12, 32.12, 32.06, 32.06, 32.06, 32.06, 32.06, 31.84, 31.84, 31.84, 31.84, 31.84, 31.85, 31.85, 31.85, 31.85, 31.85, 31.85, 31.85, 31.85, 31.85, 31.85, 32.04, 32.04, 32.04, 32.04, 32.04, 32.04, 32.04, 32.04, 32.04, 32.04, 32.21, 32.21, 32.21, 32.21, 32.21, 32.34, 32.34, 32.34, 32.34, 32.34, 32.24, 32.24, 32.24, 32.24, 32.24, 31.95, 31.95, 31.95, 31.95, 31.95, 31.79, 31.79, 31.79, 31.79, 31.79, 32.12, 32.12, 32.12, 32.12, 32.12, 32.21, 32.21, 32.21, 32.21, 32.21, 32.33, 32.33, 32.33, 32.33, 32.33, 32.47, 32.47, 32.47, 32.47, 32.47, 32.54, 32.54, 32.54, 32.54, 32.54, 32.52, 32.52, 32.52, 32.52, 32.52, 32.3, 32.3, 32.3, 32.3, 32.3, 32.16, 32.16, 32.16, 32.16, 32.16, 31.92, 31.92, 31.92, 31.92, 31.92, 32.05, 32.05, 32.05, 32.05, 32.05, 32.17, 32.17, 32.17, 32.17, 32.17, 32.25, 32.25, 32.25, 32.25, 32.25, 32.3, 32.3, 32.3, 32.3, 32.3, 32.36, 32.36, 32.36, 32.36, 32.36, 32.14, 32.14, 32.14, 32.14, 32.14, 31.85, 31.85, 31.85, 31.85, 31.85, 30.99, 30.99, 30.99, 30.99, 30.99, 30.27, 30.27, 30.27, 30.27, 30.27, 30.19, 30.19, 30.19, 30.19, 30.19, 30.2, 30.2, 30.2, 30.2, 30.2, 30.36, 30.36, 30.36, 30.36, 30.36, 30.4, 30.4, 30.4, 30.4, 30.4, 30.51, 30.51, 30.51, 30.51, 30.51, 30.52, 30.52, 30.52, 30.52, 30.52, 30.37, 30.37, 30.37, 30.37, 30.37, 30.29, 30.29, 30.29, 30.29, 30.29, 30.23, 30.23, 30.23, 30.23, 30.23, 30.32, 30.32, 30.32, 30.32, 30.32, 30.44, 30.44, 30.44, 30.44, 30.44, 30.56, 30.56, 30.56, 30.56, 30.56, 30.62, 30.62, 30.62, 30.62, 30.62, 30.66, 30.66, 30.66, 30.66, 30.66, 30.64, 30.64, 30.64, 30.64, 30.64]
                    
Loading

Details

kv_cache_usage_ratio

More
---
config:
    xyChart:
        titleFontSize: 12
        width: 900
        height: 600
    themeVariables:
        xyChart:
            titleColor: "#000000"
---
xychart-beta
    title "llama.cpp bench-server-baseline on Standard_NC4as_T4_v3
 duration=10m 550 iterations"
    y-axis "llamacpp:kv_cache_usage_ratio"
    x-axis "llamacpp:kv_cache_usage_ratio" 1715162773 --> 1715163401
    line [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.13, 0.13, 0.13, 0.13, 0.13, 0.39, 0.39, 0.39, 0.39, 0.39, 0.22, 0.22, 0.22, 0.22, 0.22, 0.29, 0.29, 0.29, 0.29, 0.29, 0.19, 0.19, 0.19, 0.19, 0.19, 0.13, 0.13, 0.13, 0.13, 0.13, 0.17, 0.17, 0.17, 0.17, 0.17, 0.13, 0.13, 0.13, 0.13, 0.13, 0.11, 0.11, 0.11, 0.11, 0.11, 0.2, 0.2, 0.2, 0.2, 0.2, 0.21, 0.21, 0.21, 0.21, 0.21, 0.13, 0.13, 0.13, 0.13, 0.13, 0.21, 0.21, 0.21, 0.21, 0.21, 0.25, 0.25, 0.25, 0.25, 0.25, 0.24, 0.24, 0.24, 0.24, 0.24, 0.14, 0.14, 0.14, 0.14, 0.14, 0.11, 0.11, 0.11, 0.11, 0.11, 0.21, 0.21, 0.21, 0.21, 0.21, 0.21, 0.21, 0.21, 0.21, 0.21, 0.12, 0.12, 0.12, 0.12, 0.12, 0.14, 0.14, 0.14, 0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.18, 0.18, 0.18, 0.18, 0.18, 0.12, 0.12, 0.12, 0.12, 0.12, 0.15, 0.15, 0.15, 0.15, 0.15, 0.27, 0.27, 0.27, 0.27, 0.27, 0.21, 0.21, 0.21, 0.21, 0.21, 0.09, 0.09, 0.09, 0.09, 0.09, 0.11, 0.11, 0.11, 0.11, 0.11, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.16, 0.16, 0.16, 0.16, 0.16, 0.13, 0.13, 0.13, 0.13, 0.13, 0.22, 0.22, 0.22, 0.22, 0.22, 0.21, 0.21, 0.21, 0.21, 0.21, 0.35, 0.35, 0.35, 0.35, 0.35, 0.1, 0.1, 0.1, 0.1, 0.1, 0.16, 0.16, 0.16, 0.16, 0.16, 0.12, 0.12, 0.12, 0.12, 0.12, 0.13, 0.13, 0.13, 0.13, 0.13, 0.18, 0.18, 0.18, 0.18, 0.18, 0.42, 0.42, 0.42, 0.42, 0.42, 0.5, 0.5, 0.5, 0.5, 0.5, 0.55, 0.55, 0.55, 0.55, 0.55, 0.43, 0.43, 0.43, 0.43, 0.43, 0.11, 0.11, 0.11, 0.11, 0.11, 0.16, 0.16, 0.16, 0.16, 0.16, 0.15, 0.15, 0.15, 0.15, 0.15, 0.14, 0.14, 0.14, 0.14, 0.14, 0.12, 0.12, 0.12, 0.12, 0.12, 0.18, 0.18, 0.18, 0.18, 0.18, 0.27, 0.27, 0.27, 0.27, 0.27, 0.2, 0.2, 0.2, 0.2, 0.2, 0.26, 0.26, 0.26, 0.26, 0.26, 0.13, 0.13, 0.13, 0.13, 0.13, 0.09, 0.09, 0.09, 0.09, 0.09, 0.12, 0.12, 0.12, 0.12, 0.12, 0.11, 0.11, 0.11, 0.11, 0.11, 0.17, 0.17, 0.17, 0.17, 0.17, 0.18, 0.18, 0.18, 0.18, 0.18, 0.17, 0.17, 0.17, 0.17, 0.17]
                    
Loading
requests_processing
More
---
config:
    xyChart:
        titleFontSize: 12
        width: 900
        height: 600
    themeVariables:
        xyChart:
            titleColor: "#000000"
---
xychart-beta
    title "llama.cpp bench-server-baseline on Standard_NC4as_T4_v3
 duration=10m 550 iterations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, 6.0, 4.0, 4.0, 4.0, 4.0, 4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0, 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 7.0, 7.0, 7.0, 7.0, 7.0, 5.0, 5.0, 5.0, 5.0, 5.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0, 7.0, 7.0, 7.0, 7.0, 7.0, 6.0, 6.0, 6.0, 6.0, 6.0, 4.0, 4.0, 4.0, 4.0, 4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 7.0, 7.0, 7.0, 7.0, 7.0, 6.0, 6.0, 6.0, 6.0, 6.0]
                    
Loading

@ngxson ngxson merged commit 1fd9c17 into ggml-org:master May 8, 2024
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants