Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feat/workflow-for-n…
Browse files Browse the repository at this point in the history
…itro-node
  • Loading branch information
InNoobWeTrust committed Mar 14, 2024
2 parents 8b2afdd + fd6500f commit 5841be8
Show file tree
Hide file tree
Showing 20 changed files with 3,316 additions and 3,456 deletions.
83 changes: 83 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Google C/C++ Code Style settings
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# Author: Kehan Xue, kehan.xue (at) gmail.com

Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never # To avoid conflict, set this "Never" and each "if statement" should include brace when coding
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterStruct: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 80
CompactNamespaces: false
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false # Make sure the * or & align on the left
EmptyLineBeforeAccessModifier: LogicalBlock
FixNamespaceComments: true
IncludeBlocks: Preserve
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Left
ReflowComments: false
# SeparateDefinitionBlocks: Always # Only support since clang-format 14
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++11
TabWidth: 4
UseTab: Never
18 changes: 12 additions & 6 deletions .github/scripts/e2e-test-llama-linux-and-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ range=$((max - min + 1))
PORT=$((RANDOM % range + min))

# Start the binary file
"$BINARY_PATH" 1 127.0.0.1 $PORT >/tmp/nitro.log 2>&1 &
"$BINARY_PATH" 1 127.0.0.1 $PORT >/tmp/nitro.log &

# Get the process id of the binary file
pid=$!
Expand All @@ -37,21 +37,27 @@ sleep 5

# Check if /tmp/testllm exists, if not, download it
if [[ ! -f "/tmp/testllm" ]]; then
wget $DOWNLOAD_URL -O /tmp/testllm
curl --connect-timeout 300 $DOWNLOAD_URL --output /tmp/testllm
fi

# Run the curl commands
response1=$(curl -o /tmp/response1.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/inferences/llamacpp/loadModel" \
response1=$(curl --connect-timeout 60 -o /tmp/response1.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/inferences/llamacpp/loadModel" \
--header 'Content-Type: application/json' \
--data '{
"llama_model_path": "/tmp/testllm",
"ctx_len": 50,
"ngl": 32,
"embedding": false
}' 2>&1)
}')

if ! ps -p $pid >/dev/null; then
echo "nitro failed to load model. Logs:"
cat /tmp/nitro.log
exit 1
fi

response2=$(
curl -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/chat/completions" \
curl --connect-timeout 60 -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/chat/completions" \
--header 'Content-Type: application/json' \
--header 'Accept: text/event-stream' \
--header 'Access-Control-Allow-Origin: *' \
Expand All @@ -67,7 +73,7 @@ response2=$(
"frequency_penalty": 0,
"presence_penalty": 0,
"temperature": 0.1
}' 2>&1
}'
)

error_occurred=0
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/e2e-test-llama-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ rem Wait for a few seconds to let the server start

rem Check if %TEMP%\testmodel exists, if not, download it
if not exist "%MODEL_PATH%" (
bitsadmin.exe /transfer "DownloadTestModel" %DOWNLOAD_URL% "%MODEL_PATH%"
curl.exe --connect-timeout 300 %DOWNLOAD_URL% --output "%MODEL_PATH%"
)

rem Define JSON strings for curl data
Expand Down
12 changes: 6 additions & 6 deletions .github/scripts/e2e-test-whisper-linux-and-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ range=$((max - min + 1))
PORT=$((RANDOM % range + min))

# Start the binary file
"$BINARY_PATH" 1 127.0.0.1 $PORT >/tmp/nitro.log 2>&1 &
"$BINARY_PATH" 1 127.0.0.1 $PORT >/tmp/nitro.log &

# Get the process id of the binary file
pid=$!
Expand All @@ -37,25 +37,25 @@ sleep 5

# Check if /tmp/testwhisper exists, if not, download it
if [[ ! -f "/tmp/testwhisper" ]]; then
wget $DOWNLOAD_URL -O /tmp/testwhisper
curl --connect-timeout 300 $DOWNLOAD_URL --output /tmp/testwhisper
fi

# Run the curl commands
response1=$(curl -o /tmp/response1.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/audio/load_model" \
response1=$(curl --connect-timeout 60 -o /tmp/response1.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/audio/load_model" \
--header 'Content-Type: application/json' \
--data '{
"model_path": "/tmp/testwhisper",
"model_id": "whisper.cpp"
}' 2>&1)
}')

response2=$(
curl -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/audio/transcriptions" \
curl --connect-timeout 60 -o /tmp/response2.log -s -w "%{http_code}" --location "http://127.0.0.1:$PORT/v1/audio/transcriptions" \
--header 'Access-Control-Allow-Origin: *' \
--form 'file=@"../whisper.cpp/samples/jfk.wav"' \
--form 'model_id="whisper.cpp"' \
--form 'temperature="0.0"' \
--form 'prompt="The transcript is about OpenAI which makes technology like DALL·E, GPT-3, and ChatGPT with the hope of one day building an AGI system that benefits all of humanity. The president is trying to raly people to support the cause."' \
2>&1
)

error_occurred=0
Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/e2e-test-whisper-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ rem Wait for a few seconds to let the server start

rem Check if %TEMP%\testwhisper exists, if not, download it
if not exist "%MODEL_PATH%" (
bitsadmin.exe /transfer "DownloadTestModel" %DOWNLOAD_URL% "%MODEL_PATH%"
curl.exe --connect-timeout 300 %DOWNLOAD_URL% --output "%MODEL_PATH%"
)

rem Define JSON strings for curl data
call set "MODEL_PATH_STRING=%%MODEL_PATH:\=\\%%"
set "curl_data1={\"model_path\":\"%MODEL_PATH_STRING%\",\"model_id\":\"whisper\"}"

rem Run the curl commands and capture the status code
curl.exe -o %TEMP%\response1.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/load_model" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1_code.log 2>&1
curl.exe --connect-timeout 60 -o %TEMP%\response1.log -s -w "%%{http_code}" --location "http://127.0.0.1:%PORT%/v1/audio/load_model" --header "Content-Type: application/json" --data "%curl_data1%" > %TEMP%\response1_code.log 2>&1

curl -o %TEMP%\response2.log -s -w "%%{http_code}" --location "http://localhost:%PORT%/v1/audio/transcriptions" ^
curl --connect-timeout 60 -o %TEMP%\response2.log -s -w "%%{http_code}" --location "http://localhost:%PORT%/v1/audio/transcriptions" ^
--form "file=@../..//whisper.cpp/samples/jfk.wav" ^
--form "model_id=whisper" > %TEMP%\response2_code.log 2>&1

Expand Down
Loading

0 comments on commit 5841be8

Please sign in to comment.