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

Make Regex, RegexTokenizer, Vocab, Vectors, SentencePiece pickle-able #1104

Merged
merged 7 commits into from
Dec 22, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Copy memory when serializing SentencePiece
  • Loading branch information
mthrok committed Dec 21, 2020
commit 613ee820dd62ffc5b5c4e2dbc61306dcd2062053
2 changes: 1 addition & 1 deletion torchtext/csrc/register_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ TORCH_LIBRARY_FRAGMENT(torchtext, m) {
[](const c10::intrusive_ptr<SentencePiece> &self) -> torch::Tensor {
auto *data = static_cast<void*>(const_cast<char*>(self->content_.data()));
auto numel = static_cast<int64_t>(self->content_.size());
return torch::from_blob(data, {numel}, {torch::kUInt8});
return torch::from_blob(data, {numel}, {torch::kUInt8}).clone();
},
// __setstate__
[](torch::Tensor state) -> c10::intrusive_ptr<SentencePiece> {
Expand Down