-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathPATCH.sentencepiece
More file actions
90 lines (85 loc) · 2.31 KB
/
PATCH.sentencepiece
File metadata and controls
90 lines (85 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Copyright 2025 The Google AI Edge Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
--- sentencepiece_processor.h 2025-04-27 15:47:21.057722872 -0700
+++ sentencepiece_processor.h 2025-04-27 15:50:12.601047364 -0700
@@ -22,6 +22,8 @@
#include <utility>
#include <vector>
+#include "absl/status/status.h"
+
#ifndef SWIG
namespace absl {
using std::string_view;
@@ -30,50 +32,8 @@
namespace sentencepiece {
namespace util {
-
-enum class StatusCode : int {
- kOk = 0,
- kCancelled = 1,
- kUnknown = 2,
- kInvalidArgument = 3,
- kDeadlineExceeded = 4,
- kNotFound = 5,
- kAlreadyExists = 6,
- kPermissionDenied = 7,
- kResourceExhausted = 8,
- kFailedPrecondition = 9,
- kAborted = 10,
- kOutOfRange = 11,
- kUnimplemented = 12,
- kInternal = 13,
- kUnavailable = 14,
- kDataLoss = 15,
- kUnauthenticated = 16,
-};
-
-class Status {
- public:
- Status();
- ~Status();
- Status(StatusCode code, absl::string_view error_message);
- Status(const Status &s);
- void operator=(const Status &s);
- bool operator==(const Status &s) const;
- bool operator!=(const Status &s) const;
- inline bool ok() const { return rep_ == nullptr; }
-
- void set_error_message(const char *str);
- const char *error_message() const;
- const char *message() const { return error_message(); }
- StatusCode code() const;
- std::string ToString() const;
-
- void IgnoreError();
-
- private:
- struct Rep;
- std::unique_ptr<Rep> rep_;
-};
+using StatusCode = absl::StatusCode;
+using Status = absl::Status;
} // namespace util
// SentencePieceProcessor:
--- common.h 2025-04-27 15:55:22.642953123 -0700
+++ common.h 2025-04-27 16:02:22.377904469 -0700
@@ -94,7 +94,7 @@
~Die() {
std::cerr << std::endl;
if (die_) {
- Abort();
+ exit(-1);
}
}
int operator&(std::ostream &) { return 0; }