Skip to content

Commit

Permalink
fix the pp_api test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
wenbingl committed Aug 27, 2024
1 parent 94340f6 commit 0859eb0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ stages:
- bash: |
set -e -x -u
./build.sh -DOCOS_ENABLE_C_API=ON
cd out/Linux
cd out/Linux/RelWithDebInfo
ctest -C RelWithDebInfo --output-on-failure
displayName: Build ort-extensions with API enabled and run tests
Expand Down
1 change: 0 additions & 1 deletion shared/api/c_api_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class span {
data_ = v.data();
size_ = v.size();
}
span(std::initializer_list<value_type> il) : data_(il.begin()), size_(il.size()) {}

const T& operator[](size_t i) const { return data_[i]; }
T& operator[](size_t i) { return data_[i]; }
Expand Down
5 changes: 2 additions & 3 deletions test/pp_api_test/test_tokenizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,10 @@ TEST(OrtxTokenizerTest, CodeGenTokenizer) {
// std::cout << out_text[0] << std::endl;
EXPECT_EQ(out_text[0], input[0]);

ort_extensions::span<extTokenId_t const>
// 252 and the following ids cannot be decoded as a valid utf-8 string
invalid_token_ids_span = {14675, 8466, 705, 252, 538, 5374, 82, 329, 4554};
std::vector<extTokenId_t> invalid_token_ids_span = {14675, 8466, 705, 252, 538, 5374, 82, 329, 4554};
std::vector<std::string> out_text1;
status = tokenizer->Detokenize({invalid_token_ids_span}, out_text1);
status = tokenizer->Detokenize({ort_extensions::span<const extTokenId_t>(invalid_token_ids_span)}, out_text1);
EXPECT_TRUE(status.IsOk());
EXPECT_EQ(out_text1.size(), 1);
std::string out_text_ref = out_text1.back();
Expand Down

0 comments on commit 0859eb0

Please sign in to comment.