Skip to content

Commit

Permalink
Merge branch 'main' into relref-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
johndmulhausen authored Jan 15, 2025
2 parents f01b423 + 1da0041 commit 5dfb035
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 36 deletions.
2 changes: 1 addition & 1 deletion content/ref/python/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ For reference documentation, see https://docs.wandb.com/ref/python.

| Other Members | |
| :--- | :--- |
| `__version__`<a id="__version__"></a> | `'0.19.2'` |
| `__version__`<a id="__version__"></a> | `'0.19.3'` |
| `config`<a id="config"></a> | |
| `summary`<a id="summary"></a> | |
60 changes: 28 additions & 32 deletions content/ref/python/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,35 @@ title: init

Start a new run to track and log to W&B.


```python
from typing import Sequence, Literal, Any

def init(
entity: str | None = None,
project: str | None = None,
dir: "StrPath" | None = None, # Assuming StrPath is defined elsewhere
id: str | None = None,
name: str | None = None,
notes: str | None = None,
tags: Sequence[str] | None = None,
config: dict[str, Any] | str | None = None,
config_exclude_keys: list[str] | None = None,
config_include_keys: list[str] | None = None,
allow_val_change: bool | None = None,
group: str | None = None,
job_type: str | None = None,
mode: Literal["online", "offline", "disabled"] | None = None,
force: bool | None = None,
anonymous: Literal["never", "allow", "must"] | None = None,
reinit: bool | None = None,
resume: bool | Literal["allow", "never", "must", "auto"] | None = None,
resume_from: str | None = None,
fork_from: str | None = None,
save_code: bool | None = None,
tensorboard: bool | None = None,
sync_tensorboard: bool | None = None,
monitor_gym: bool | None = None,
settings: (
"Settings" | dict[str, Any] | None
) = None, # Assuming Settings is defined elsewhere
) -> "Run": # Assuming Run is defined elsewhere
pass
init(
entity: (str | None) = None,
project: (str | None) = None,
dir: (StrPath | None) = None,
id: (str | None) = None,
name: (str | None) = None,
notes: (str | None) = None,
tags: (Sequence[str] | None) = None,
config: (dict[str, Any] | str | None) = None,
config_exclude_keys: (list[str] | None) = None,
config_include_keys: (list[str] | None) = None,
allow_val_change: (bool | None) = None,
group: (str | None) = None,
job_type: (str | None) = None,
mode: (Literal['online', 'offline', 'disabled'] | None) = None,
force: (bool | None) = None,
anonymous: (Literal['never', 'allow', 'must'] | None) = None,
reinit: (bool | None) = None,
resume: (bool | Literal['allow', 'never', 'must', 'auto'] | None) = None,
resume_from: (str | None) = None,
fork_from: (str | None) = None,
save_code: (bool | None) = None,
tensorboard: (bool | None) = None,
sync_tensorboard: (bool | None) = None,
monitor_gym: (bool | None) = None,
settings: (Settings | dict[str, Any] | None) = None
) -> Run
```

In an ML training pipeline, you could add `wandb.init()` to the beginning of
Expand Down
11 changes: 8 additions & 3 deletions content/ref/python/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ run = wandb.init()
examples = []
for i in range(3):
pixels = np.random.randint(
low=0, high=256, size=(100, 100, 3), dtype=np.uint8
low=0,
high=256,
size=(100, 100, 3),
dtype=np.uint8,
)
pil_image = PILImage.fromarray(pixels, mode="RGB")
image = wandb.Image(pil_image, caption=f"random field {i}")
Expand All @@ -199,15 +202,17 @@ run.log({"examples": examples})

<!--yeadoc-test:init-and-log-video-numpy-->


```python
import numpy as np
import wandb

run = wandb.init()
# axes are (time, channel, height, width)
frames = np.random.randint(
low=0, high=256, size=(10, 3, 100, 100), dtype=np.uint8
low=0,
high=256,
size=(10, 3, 100, 100),
dtype=np.uint8,
)
run.log({"video": wandb.Video(frames, fps=4)})
```
Expand Down

0 comments on commit 5dfb035

Please sign in to comment.