Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions torchtext/csrc/register_torchbindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ TORCH_LIBRARY_FRAGMENT(torchtext, m) {
},
// __setstate__
[](torch::Tensor state) -> c10::intrusive_ptr<SentencePiece> {
state = state.to(at::kCPU);
auto* data = static_cast<char*>(state.data_ptr());
auto numel = state.size(0);
return c10::make_intrusive<SentencePiece>(std::string(data, numel));
Expand Down
2 changes: 1 addition & 1 deletion torchtext/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _get_ngrams(n):
yield " ".join(x)


class RandomShuffler(object):
class RandomShuffler:
"""Use random functions while keeping track of the random state to make it
reproducible and deterministic."""

Expand Down
2 changes: 1 addition & 1 deletion torchtext/vocab/vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _infer_shape(f):
return num_lines, vector_dim


class Vectors(object):
class Vectors:
def __init__(self, name, cache=None, url=None, unk_init=None, max_vectors=None) -> None:
"""
Args:
Expand Down