Skip to content

Commit 7d49fb9

Browse files
qgallouedecleaderofARS
authored andcommitted
Remove Neptune integration references and deprecate NeptuneCallback (huggingface#42666)
Remove Neptune integration references and deprecate NeptuneCallback
1 parent ada5cae commit 7d49fb9

File tree

7 files changed

+15
-103
lines changed

7 files changed

+15
-103
lines changed

docs/source/en/main_classes/callback.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ By default, `TrainingArguments.report_to` is set to `"all"`, so a [`Trainer`] wi
3636
- [`~integrations.WandbCallback`] if [wandb](https://www.wandb.com/) is installed.
3737
- [`~integrations.CometCallback`] if [comet_ml](https://www.comet.com/site/) is installed.
3838
- [`~integrations.MLflowCallback`] if [mlflow](https://www.mlflow.org/) is installed.
39-
- [`~integrations.NeptuneCallback`] if [neptune](https://neptune.ai/) is installed.
4039
- [`~integrations.AzureMLCallback`] if [azureml-sdk](https://pypi.org/project/azureml-sdk/) is
4140
installed.
4241
- [`~integrations.CodeCarbonCallback`] if [codecarbon](https://pypi.org/project/codecarbon/) is
@@ -84,8 +83,6 @@ Here is the list of the available [`TrainerCallback`] in the library:
8483

8584
[[autodoc]] integrations.CodeCarbonCallback
8685

87-
[[autodoc]] integrations.NeptuneCallback
88-
8986
[[autodoc]] integrations.ClearMLCallback
9087

9188
[[autodoc]] integrations.DagsHubCallback

docs/source/ja/main_classes/callback.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ rendered properly in your Markdown viewer.
3737
- [`~integrations.WandbCallback`] [wandb](https://www.wandb.com/) がインストールされている場合。
3838
- [`~integrations.CometCallback`] [comet_ml](https://www.comet.com/site/) がインストールされている場合。
3939
- [mlflow](https://www.mlflow.org/) がインストールされている場合は [`~integrations.MLflowCallback`]
40-
- [`~integrations.NeptuneCallback`] [neptune](https://neptune.ai/) がインストールされている場合。
4140
- [`~integrations.AzureMLCallback`] [azureml-sdk](https://pypi.org/project/azureml-sdk/) の場合
4241
インストールされています。
4342
- [`~integrations.CodeCarbonCallback`] [codecarbon](https://pypi.org/project/codecarbon/) の場合
@@ -82,8 +81,6 @@ rendered properly in your Markdown viewer.
8281

8382
[[autodoc]] integrations.CodeCarbonCallback
8483

85-
[[autodoc]] integrations.NeptuneCallback
86-
8784
[[autodoc]] integrations.ClearMLCallback
8885

8986
[[autodoc]] integrations.DagsHubCallback

docs/source/ko/main_classes/callback.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ rendered properly in your Markdown viewer.
3636
사용됩니다.
3737
- [`~integrations.CometCallback`][comet_ml](https://www.comet.com/site/)이 설치되어 있으면 사용됩니다.
3838
- [`~integrations.MLflowCallback`][mlflow](https://www.mlflow.org/)가 설치되어 있으면 사용됩니다.
39-
- [`~integrations.NeptuneCallback`][neptune](https://neptune.ai/)이 설치되어 있으면 사용됩니다.
4039
- [`~integrations.AzureMLCallback`][azureml-sdk](https://pypi.org/project/azureml-sdk/)가 설치되어
4140
있으면 사용됩니다.
4241
- [`~integrations.CodeCarbonCallback`][codecarbon](https://pypi.org/project/codecarbon/)이 설치되어
@@ -82,8 +81,6 @@ rendered properly in your Markdown viewer.
8281

8382
[[autodoc]] integrations.CodeCarbonCallback
8483

85-
[[autodoc]] integrations.NeptuneCallback
86-
8784
[[autodoc]] integrations.ClearMLCallback
8885

8986
[[autodoc]] integrations.DagsHubCallback

docs/source/zh/main_classes/callback.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Callbacks是“只读”的代码片段,除了它们返回的[TrainerControl]
3030
- [`~integrations.WandbCallback`],如果安装了[wandb](https://www.wandb.com/)
3131
- [`~integrations.CometCallback`],如果安装了[comet_ml](https://www.comet.com/site/)
3232
- [`~integrations.MLflowCallback`],如果安装了[mlflow](https://www.mlflow.org/)
33-
- [`~integrations.NeptuneCallback`],如果安装了[neptune](https://neptune.ai/)
3433
- [`~integrations.AzureMLCallback`],如果安装了[azureml-sdk](https://pypi.org/project/azureml-sdk/)
3534
- [`~integrations.CodeCarbonCallback`],如果安装了[codecarbon](https://pypi.org/project/codecarbon/)
3635
- [`~integrations.ClearMLCallback`],如果安装了[clearml](https://github.com/allegroai/clearml)
@@ -71,8 +70,6 @@ Callbacks是“只读”的代码片段,除了它们返回的[TrainerControl]
7170

7271
[[autodoc]] integrations.CodeCarbonCallback
7372

74-
[[autodoc]] integrations.NeptuneCallback
75-
7673
[[autodoc]] integrations.ClearMLCallback
7774

7875
[[autodoc]] integrations.DagsHubCallback

examples/pytorch/README.md

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ You can easily log and monitor your runs code. The following are currently suppo
199199
* [TensorBoard](https://www.tensorflow.org/tensorboard)
200200
* [Weights & Biases](https://docs.wandb.ai/integrations/huggingface)
201201
* [Comet ML](https://www.comet.com/docs/v2/integrations/ml-frameworks/transformers/)
202-
* [Neptune](https://docs.neptune.ai/integrations-and-supported-tools/model-training/hugging-face)
203202
* [ClearML](https://clear.ml/docs/latest/docs/getting_started/ds/ds_first_steps)
204203
* [DVCLive](https://dvc.org/doc/dvclive/ml-frameworks/huggingface)
205204

@@ -256,91 +255,6 @@ or if in a Conda environment:
256255
conda install -c comet_ml -c anaconda -c conda-forge comet_ml
257256
```
258257

259-
### Neptune
260-
261-
First, install the Neptune client library. You can do it with either `pip` or `conda`:
262-
263-
`pip`:
264-
265-
```bash
266-
pip install neptune
267-
```
268-
269-
`conda`:
270-
271-
```bash
272-
conda install -c conda-forge neptune
273-
```
274-
275-
Next, in your model training script, import `NeptuneCallback`:
276-
277-
```python
278-
from transformers.integrations import NeptuneCallback
279-
```
280-
281-
To enable Neptune logging, in your `TrainingArguments`, set the `report_to` argument to `"neptune"`:
282-
283-
```python
284-
training_args = TrainingArguments(
285-
"quick-training-distilbert-mrpc",
286-
eval_strategy="steps",
287-
eval_steps=20,
288-
report_to="neptune",
289-
)
290-
291-
trainer = Trainer(
292-
model,
293-
training_args,
294-
...
295-
)
296-
```
297-
298-
**Note:** This method requires saving your Neptune credentials as environment variables (see the bottom of the section).
299-
300-
Alternatively, for more logging options, create a Neptune callback:
301-
302-
```python
303-
neptune_callback = NeptuneCallback()
304-
```
305-
306-
To add more detail to the tracked run, you can supply optional arguments to `NeptuneCallback`.
307-
308-
Some examples:
309-
310-
```python
311-
neptune_callback = NeptuneCallback(
312-
name = "DistilBERT",
313-
description = "DistilBERT fine-tuned on GLUE/MRPC",
314-
tags = ["args-callback", "fine-tune", "MRPC"], # tags help you manage runs in Neptune
315-
base_namespace="callback", # the default is "finetuning"
316-
log_checkpoints = "best", # other options are "last", "same", and None
317-
capture_hardware_metrics = False, # additional keyword arguments for a Neptune run
318-
)
319-
```
320-
321-
Pass the callback to the Trainer:
322-
323-
```python
324-
training_args = TrainingArguments(..., report_to=None)
325-
trainer = Trainer(
326-
model,
327-
training_args,
328-
...
329-
callbacks=[neptune_callback],
330-
)
331-
```
332-
333-
Now, when you start the training with `trainer.train()`, your metadata will be logged in Neptune.
334-
335-
**Note:** Although you can pass your **Neptune API token** and **project name** as arguments when creating the callback, the recommended way is to save them as environment variables:
336-
337-
| Environment variable | Value |
338-
| :------------------- | :--------------------------------------------------- |
339-
| `NEPTUNE_API_TOKEN` | Your Neptune API token. To find and copy it, click your Neptune avatar and select **Get your API token**. |
340-
| `NEPTUNE_PROJECT` | The full name of your Neptune project (`workspace-name/project-name`). To find and copy it, head to **project settings** → **Properties**. |
341-
342-
For detailed instructions and examples, see the [Neptune docs](https://docs.neptune.ai/integrations/transformers/).
343-
344258
### ClearML
345259

346260
To use ClearML, install the clearml package with:

src/transformers/integrations/integration_utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import shutil
2727
import sys
2828
import tempfile
29+
import warnings
2930
from dataclasses import fields
3031
from enum import Enum
3132
from pathlib import Path
@@ -1455,6 +1456,10 @@ def __init__(self):
14551456
class NeptuneCallback(TrainerCallback):
14561457
"""TrainerCallback that sends the logs to [Neptune](https://app.neptune.ai).
14571458
1459+
> [!WARNING]
1460+
> Neptune integration is deprecated and will be removed in a future version of Transformers. We recommend using
1461+
> other supported experiment tracking integrations.
1462+
14581463
Args:
14591464
api_token (`str`, *optional*): Neptune API token obtained upon registration.
14601465
You can leave this argument out if you have saved your token to the `NEPTUNE_API_TOKEN` environment
@@ -1500,6 +1505,11 @@ def __init__(
15001505
log_checkpoints: str | None = None,
15011506
**neptune_run_kwargs,
15021507
):
1508+
warnings.warn(
1509+
"The NeptuneCallback is deprecated and will be removed in a future version of Transformers. We recommend "
1510+
"using other supported experiment tracking integrations.",
1511+
FutureWarning,
1512+
)
15031513
if not is_neptune_available():
15041514
raise ValueError(
15051515
"NeptuneCallback requires the Neptune client library to be installed. "

src/transformers/training_args.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,9 @@ class TrainingArguments:
596596
instance of `Dataset`.
597597
report_to (`str` or `list[str]`, *optional*, defaults to `"none"`):
598598
The list of integrations to report the results and logs to. Supported platforms are `"azure_ml"`,
599-
`"clearml"`, `"codecarbon"`, `"comet_ml"`, `"dagshub"`, `"dvclive"`, `"flyte"`, `"mlflow"`, `"neptune"`,
600-
`"swanlab"`, `"tensorboard"`, `"trackio"` and `"wandb"`. Use `"all"` to report to all integrations
601-
installed, `"none"` for no integrations.
599+
`"clearml"`, `"codecarbon"`, `"comet_ml"`, `"dagshub"`, `"dvclive"`, `"flyte"`, `"mlflow"`, `"swanlab"`,
600+
`"tensorboard"`, `"trackio"` and `"wandb"`. Use `"all"` to report to all integrations installed, `"none"`
601+
for no integrations.
602602
project (`str`, *optional*, defaults to `"huggingface"`):
603603
The name of the project to use for logging. Currently, only used by Trackio.
604604
trackio_space_id (`str` or `None`, *optional*, defaults to `"trackio"`):
@@ -2386,8 +2386,8 @@ def set_logging(
23862386
report_to (`str` or `list[str]`, *optional*, defaults to `"none"`):
23872387
The list of integrations to report the results and logs to. Supported platforms are `"azure_ml"`,
23882388
`"clearml"`, `"codecarbon"`, `"comet_ml"`, `"dagshub"`, `"dvclive"`, `"flyte"`, `"mlflow"`,
2389-
`"neptune"`, `"swanlab"`, `"tensorboard"`, `"trackio"` and `"wandb"`. Use `"all"` to report to all
2390-
integrations installed, `"none"` for no integrations.
2389+
`"swanlab"`, `"tensorboard"`, `"trackio"` and `"wandb"`. Use `"all"` to report to all integrations
2390+
installed, `"none"` for no integrations.
23912391
first_step (`bool`, *optional*, defaults to `False`):
23922392
Whether to log and evaluate the first `global_step` or not.
23932393
nan_inf_filter (`bool`, *optional*, defaults to `True`):

0 commit comments

Comments
 (0)