torchrl-nightly 2025.7.17__cp311-cp311-manylinux1_x86_64.whl → 2025.7.18__cp311-cp311-manylinux1_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- torchrl/_torchrl.cpython-311-x86_64-linux-gnu.so +0 -0
- torchrl/data/llm/history.py +36 -0
- torchrl/version.py +2 -2
- {torchrl_nightly-2025.7.17.dist-info → torchrl_nightly-2025.7.18.dist-info}/METADATA +1 -1
- {torchrl_nightly-2025.7.17.dist-info → torchrl_nightly-2025.7.18.dist-info}/RECORD +8 -8
- {torchrl_nightly-2025.7.17.dist-info → torchrl_nightly-2025.7.18.dist-info}/LICENSE +0 -0
- {torchrl_nightly-2025.7.17.dist-info → torchrl_nightly-2025.7.18.dist-info}/WHEEL +0 -0
- {torchrl_nightly-2025.7.17.dist-info → torchrl_nightly-2025.7.18.dist-info}/top_level.txt +0 -0
Binary file
|
torchrl/data/llm/history.py
CHANGED
@@ -713,6 +713,42 @@ class History(TensorClass["nocast"]):
|
|
713
713
|
| transformers.AutoProcessor # noqa: F821
|
714
714
|
| None = None,
|
715
715
|
) -> History:
|
716
|
+
r"""Inverts a chat template into a History object.
|
717
|
+
|
718
|
+
Args:
|
719
|
+
text (str | list[str]): The chat template to invert.
|
720
|
+
chat_template_name (str, optional): The name of the chat template to use.
|
721
|
+
tokenizer (transformers.AutoTokenizer | transformers.AutoProcessor, optional): The tokenizer to use.
|
722
|
+
|
723
|
+
Returns:
|
724
|
+
History: The inverted History object.
|
725
|
+
|
726
|
+
Examples:
|
727
|
+
>>> from torchrl.data.llm.history import History
|
728
|
+
>>> from transformers import AutoTokenizer
|
729
|
+
>>> tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
|
730
|
+
>>> text = "<|im_start|>system\nYou are a helpful assistant.\n<|im_end|>\n<|im_start|>user\nWrite a python script that gives the capital of France or Germany.\n<|im_end|>\n<|im_start|>assistant\n<think>The capital of France is Paris, the capital of Germany is Berlin.</think>\n<answer><python>\n"
|
731
|
+
>>> history = History.from_text(text, tokenizer=tokenizer)
|
732
|
+
>>> print(history)
|
733
|
+
History(
|
734
|
+
content=NonTensorStack(
|
735
|
+
['You are a helpful assistant.', 'Write a python s...,
|
736
|
+
batch_size=torch.Size([3]),
|
737
|
+
device=None),
|
738
|
+
is_complete=NonTensorStack(
|
739
|
+
[True, True, False],
|
740
|
+
batch_size=torch.Size([3]),
|
741
|
+
device=None),
|
742
|
+
role=NonTensorStack(
|
743
|
+
['system', 'user', 'assistant'],
|
744
|
+
batch_size=torch.Size([3]),
|
745
|
+
device=None),
|
746
|
+
tool_calls=None,
|
747
|
+
tool_responses=None,
|
748
|
+
batch_size=torch.Size([3]),
|
749
|
+
device=None,
|
750
|
+
is_shared=False)
|
751
|
+
"""
|
716
752
|
if chat_template_name is None:
|
717
753
|
if chat_template is not None:
|
718
754
|
# TODO: find best match given template
|
torchrl/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
__version__ = '2025.7.
|
2
|
-
git_version = '
|
1
|
+
__version__ = '2025.7.18'
|
2
|
+
git_version = '4001d9cb73cea4498b0fdfe420effc58a5a336be'
|
@@ -3,9 +3,9 @@ build_tools/setup_helpers/__init__.py,sha256=7l8TvVqxKezgzKCLuRv20mvGLloprFVZYm8
|
|
3
3
|
build_tools/setup_helpers/extension.py,sha256=4-PDLr-pw40bJnd9SfxnTaSjUyuXU_Tg8yOg69Kl0o4,5914
|
4
4
|
torchrl/__init__.py,sha256=mhDBx2UIuBKc0gmi8dVNHokQ6tCbIovruZmyAxcSsy8,2938
|
5
5
|
torchrl/_extension.py,sha256=z7wQ8i1iYWYcnygq_j0nq9sT-koY13tfHhTLNbMk17Q,2353
|
6
|
-
torchrl/_torchrl.cpython-311-x86_64-linux-gnu.so,sha256=
|
6
|
+
torchrl/_torchrl.cpython-311-x86_64-linux-gnu.so,sha256=eeR76ALpLtW24EELsbGcxn5fqmxob4vgERxzWgi3MF8,21432520
|
7
7
|
torchrl/_utils.py,sha256=Cw5EG6x5oSZF1iE3YCs1a32VUKp0rTXIs2u67q9zKUI,41078
|
8
|
-
torchrl/version.py,sha256=
|
8
|
+
torchrl/version.py,sha256=MHs4CxNjQupYI_f84bY7dOAAfPSU9yN6TOyxiS7tS8c,83
|
9
9
|
torchrl/collectors/__init__.py,sha256=hJ3JD6shRku0BL6SzJQq44FZ5Q1RGR8LealFyU3FRn4,799
|
10
10
|
torchrl/collectors/collectors.py,sha256=HpaW-y0bQOaOql8_7VyEPJ084CulrVwn6iBpGYoHyH4,178287
|
11
11
|
torchrl/collectors/utils.py,sha256=MlXrkYuDmV0Em-tVNQiLL32FWgPNDgceYYG_GgpiviA,11320
|
@@ -41,7 +41,7 @@ torchrl/data/datasets/utils.py,sha256=nAFDTlBIPyEoPoJC-Hc_fcOhzE7UZQE4BwKxq15Vhv
|
|
41
41
|
torchrl/data/datasets/vd4rl.py,sha256=z90MqrxKzod8TPGK0uzkC6vw5wQIE4cgrDAC4e72jyk,18262
|
42
42
|
torchrl/data/llm/__init__.py,sha256=B4Ekok-w5PMiWcfmAGXaseaN6hWdNOr4WebeLrHfBVQ,975
|
43
43
|
torchrl/data/llm/dataset.py,sha256=t-41hAzQcjrdoKwpHIMbcrT7pRcQ7DHl2a1-lr6E7W4,20703
|
44
|
-
torchrl/data/llm/history.py,sha256=
|
44
|
+
torchrl/data/llm/history.py,sha256=l9JSxIO5eLUFwHH5IZkANSrByYa8BGmtxMlNXYf2fbs,59640
|
45
45
|
torchrl/data/llm/prompt.py,sha256=bg5LzJfwOq5Ns72KQMciIprMWAmDDinzdopwdopU04c,8380
|
46
46
|
torchrl/data/llm/reward.py,sha256=FbPchNXG3smJV9NCbB5Yk4grsCa2Se4KZ_tojVLKWQM,8404
|
47
47
|
torchrl/data/llm/topk.py,sha256=mYXCgJS4TuEVLZfTNccQd6kmC858AAh2Ygy0q_K1hlY,8365
|
@@ -223,8 +223,8 @@ torchrl/trainers/helpers/losses.py,sha256=sHlJqjh02t8cKN73X35Azd_OoWGurohLuviB8Y
|
|
223
223
|
torchrl/trainers/helpers/models.py,sha256=ihTERG2c96E8cS3Tnul6a_ys6iDEEJmHh05p9blQTW8,21807
|
224
224
|
torchrl/trainers/helpers/replay_buffer.py,sha256=ZUZHOa0TILyeWJ3iahzTJ6UvMl_0FdxuZfJEja94Bn8,2001
|
225
225
|
torchrl/trainers/helpers/trainers.py,sha256=j6B5XA7_FFHMQeOIQwjNcO0CGE_4mZKUC9_jH_iqqh4,12071
|
226
|
-
torchrl_nightly-2025.7.
|
227
|
-
torchrl_nightly-2025.7.
|
228
|
-
torchrl_nightly-2025.7.
|
229
|
-
torchrl_nightly-2025.7.
|
230
|
-
torchrl_nightly-2025.7.
|
226
|
+
torchrl_nightly-2025.7.18.dist-info/LICENSE,sha256=xdjS4_xk-IwnLuIFCvTYTl9Y8aXRejqpmke3dGam_nI,1098
|
227
|
+
torchrl_nightly-2025.7.18.dist-info/METADATA,sha256=WXjQMMShf5DZauh7u0-WceFhOWyJ6aA-YNOEN9Z2pt0,42772
|
228
|
+
torchrl_nightly-2025.7.18.dist-info/WHEEL,sha256=e3VbkNOSuK0uEGKey5iz4S8FvWrQAw-zWtlYJiG5LyY,105
|
229
|
+
torchrl_nightly-2025.7.18.dist-info/top_level.txt,sha256=JeTJ1jV7QJwLcUS1nr21aPn_wb-XlAZ9c-z_EH472JA,20
|
230
|
+
torchrl_nightly-2025.7.18.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|