docstr: Encodes a string into stable tokens and possible completion sequences.
  
  Note that the stable tokens will only represent a substring of `text`.
  
  See `encode` for more details on `allowed_special` and `disallowed_special`.
  
  This API should itself be considered unstable.
  
  ```
  >>> enc.encode_with_unstable("hello fanta")
  ([31373], [(277, 4910), (5113, 265), ..., (8842,)])
  
  >>> text = "..."
  >>> stable_tokens, completions = enc.encode_with_unstable(text)
  >>> assert text.encode().startswith(enc.decode_bytes(stable_tokens))
  >>> assert all(enc.decode_bytes(stable_tokens + seq).startswith(text.encode()) for seq in completions)
  ```
docstr_tok: ["Encodes","a","string","into","stable","tokens","and","possible","completion","sequences",".","Note","that","the","stable","tokens","will","only","represent","a","substring","of","`","text","`",".","See","`","encode","`","for","more","details","on","`","allowed_special","`","and","`","disallowed_special","`",".","This","API","should","itself","be","considered","unstable",".","``","`",">",">",">","enc.encode_with_unstable","(","``","hello","fanta","''",")","(","[","31373","]",",","[","(","277",",","4910",")",",","(","5113",",","265",")",",","...",",","(","8842",",",")","]",")",">",">",">","text","=","``","...","''",">",">",">","stable_tokens",",","completions","=","enc.encode_with_unstable","(","text",")",">",">",">","assert","text.encode","(",")",".startswith","(","enc.decode_bytes","(","stable_tokens",")",")",">",">",">","assert","all","(","enc.decode_bytes","(","stable_tokens","+","seq",")",".startswith","(","text.encode","(",")",")","for","seq","in","completions",")","``","`"]
code: def encode_with_unstable(
      self,
      text: str,
      *,
      allowed_special: Union[
          Literal["all"], AbstractSet[str]
      ] = set(),  # noqa: B006
      disallowed_special: Union[
          Literal["all"], Collection[str]
      ] = "all",
  ) -> tuple[list[int], list[list[int]]]:
      """Encodes a string into stable tokens and possible completion sequences.
  
      Note that the stable tokens will only represent a substring of `text`.
  
      See `encode` for more details on `allowed_special` and `disallowed_special`.
  
      This API should itself be considered unstable.
  
      ```
      >>> enc.encode_with_unstable("hello fanta")
      ([31373], [(277, 4910), (5113, 265), ..., (8842,)])
  
      >>> text = "..."
      >>> stable_tokens, completions = enc.encode_with_unstable(text)
      >>> assert text.encode().startswith(enc.decode_bytes(stable_tokens))
      >>> assert all(enc.decode_bytes(stable_tokens + seq).startswith(text.encode()) for seq in completions)
      ```
      """
      if allowed_special == "all":
          allowed_special = self.special_tokens_set
      if disallowed_special == "all":
          disallowed_special = self.special_tokens_set - allowed_special
      if disallowed_special:
          if not isinstance(disallowed_special, frozenset):
              disallowed_special = frozenset(disallowed_special)
          if match := _special_token_regex(disallowed_special).search(
              text
          ):
              raise_disallowed_special_token(match.group())
  
      return self._core_bpe.encode_with_unstable(text, allowed_special)
  
imports: from __future__ import annotations
  import functools
  from concurrent.futures import ThreadPoolExecutor
  from typing import AbstractSet, Collection, Literal, NoReturn, Optional, Union
  import regex
  from tiktoken import _tiktoken
label_desc: Use image node_id 7 for calling the Encoding obj's underlying member method code with example usage: obj.encode_with_unstable(text) and returns: self