### Clone FastDeploy Examples and Start Server Source: https://visualdl.readthedocs.io/zh/latest/components/fastdeploy_server/README.html Commands to clone the FastDeploy repository and launch the server for testing. ```bash git clone https://github.com/PaddlePaddle/FastDeploy.git cd FastDeploy/examples visualdl --host 0.0.0.0 --port 8080 ``` -------------------------------- ### Install VisualDL from source Source: https://visualdl.readthedocs.io/zh/latest/README.html Clone the repository and build the wheel file to install VisualDL from source. ```bash git clone https://github.com/PaddlePaddle/VisualDL.git cd VisualDL python setup.py bdist_wheel pip install --upgrade dist/visualdl-*.whl ``` -------------------------------- ### Start the VisualDL server Source: https://visualdl.readthedocs.io/zh/latest/components/fastdeploy_client/README.html Command to launch the VisualDL server with specified host and port settings. ```bash visualdl --host 0.0.0.0 --port 8080 ``` -------------------------------- ### Basic VisualDL Launch Command Source: https://visualdl.readthedocs.io/zh/latest/README.html Start the VisualDL panel by pointing it to a specific log directory. ```bash visualdl --logdir ./log ``` -------------------------------- ### Install VisualDL Source: https://visualdl.readthedocs.io/zh/latest/components/fastdeploy_server/README.html Command to install the VisualDL package within the container environment. ```bash python -m pip install visualdl ``` -------------------------------- ### Install VisualDL via pip Source: https://visualdl.readthedocs.io/zh/latest/README.html Install the VisualDL package using the pip command with a specified mirror. ```bash python -m pip install visualdl -i https://mirror.baidu.com/pypi/simple ``` -------------------------------- ### Launch VisualDL Server Source: https://visualdl.readthedocs.io/zh/latest/components/profiler/README.html Command to start the VisualDL web interface for visualizing the collected profiling data. ```bash visualdl --logdir ./profiler_demo --port 8080 ``` -------------------------------- ### Record Embeddings Example Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Example demonstrating how to initialize a LogWriter and record embeddings using the add_embeddings method. ```python from visualdl import LogWriter if __name__ == '__main__': hot_vectors = [ [1.3561076367500755, 1.3116267195134017, 1.6785401875616097], [1.1039614644440658, 1.8891609992484688, 1.32030488587171], [1.9924524852447711, 1.9358920727142739, 1.2124401279391606], [1.4129542689796446, 1.7372166387197474, 1.7317806077076527], [1.3913371800587777, 1.4684674577930312, 1.5214136352476377]] labels = ["label_1", "label_2", "label_3", "label_4", "label_5"] # initialize a recorder with LogWriter(logdir="./log/high_dimensional_test/train") as writer: # recorde a set of labels and corresponding hot_vectors to the recorder writer.add_embeddings(tag='default', labels=labels, hot_vectors=hot_vectors) ``` -------------------------------- ### Image Logging Demo Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Example script demonstrating how to initialize a LogWriter and record cropped images at each training step. ```python import numpy as np from PIL import Image from visualdl import LogWriter def random_crop(img): """get random 100x100 slices of image """ img = Image.open(img) w, h = img.size random_w = np.random.randint(0, w - 100) random_h = np.random.randint(0, h - 100) r = img.crop((random_w, random_h, random_w + 100, random_h + 100)) return np.asarray(r) if __name__ == '__main__': # initialize a recorder with LogWriter(logdir="./log/image_test/train") as writer: for step in range(6): # add image data writer.add_image(tag="eye", img=random_crop("../../docs/images/eye.jpg"), step=step) ``` -------------------------------- ### Logging Audio Data Example Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Demonstrates how to use LogWriter to record audio data from a WAV file. ```python from visualdl import LogWriter from scipy.io import wavfile if __name__ == '__main__': with LogWriter(logdir="./log/audio_test/train") as writer: sample_rate, audio_data = wavfile.read('./test.wav') writer.add_audio(tag="audio_tag", audio_array=audio_data, step=0, sample_rate=sample_rate) ``` -------------------------------- ### Launch VisualDL Server Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Starts the VisualDL server on the specified port to access components like X2Paddle. ```bash visualdl --port 8080 ``` -------------------------------- ### Run FastDeploy Container Source: https://visualdl.readthedocs.io/zh/latest/components/fastdeploy_server/README.html Command to start a GPU-enabled FastDeploy container with host networking and volume mapping. ```bash nvidia-docker run -it --net=host --name fd_serving -v `pwd`/:/FastDeploy registry.baidubce.com/paddlepaddle/fastdeploy:1.0.2-gpu-cuda11.4-trt8.4-21.10 bash ``` -------------------------------- ### Implement and log a dynamic model Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Example of defining a neural network using paddle.nn.Layer and logging it with LogWriter. ```python import paddle import paddle.nn as nn import paddle.nn.functional as F from visualdl import LogWriter class MyNet(nn.Layer): def __init__(self): super(MyNet, self).__init__() self.conv1 = nn.Conv2D( in_channels=1, out_channels=20, kernel_size=5, stride=1, padding=2) self.max_pool1 = nn.MaxPool2D(kernel_size=2, stride=2) self.conv2 = nn.Conv2D( in_channels=20, out_channels=20, kernel_size=5, stride=1, padding=2) self.max_pool2 = nn.MaxPool2D(kernel_size=2, stride=2) self.fc = nn.Linear(in_features=980, out_features=10) def forward(self, inputs): x = self.conv1(inputs) x = F.relu(x) x = self.max_pool1(x) x = self.conv2(x) x = F.relu(x) x = self.max_pool2(x) x = paddle.reshape(x, [x.shape[0], -1]) x = self.fc(x) return x net = MyNet() with LogWriter(logdir="./log/graph_test/") as writer: writer.add_graph( model=net, input_spec=[paddle.static.InputSpec([-1, 1, 28, 28], 'float32')], verbose=True) ``` -------------------------------- ### Record Hyperparameters and Metrics Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Example demonstrating how to log hyperparameter dictionaries and corresponding scalar metrics using LogWriter. ```python from visualdl import LogWriter # This demo demonstrates the hyperparameter records of two experiments. Take the first # experiment data as an example, First, record the data of the hyperparameter `hparams` # in the `add_hparams` interface. Then specify the name of `metrics` to be recorded later. # Finally, use `add_scalar` to specifically record the data of `metrics`. Note that the # `metrics_list` parameter in the `add_hparams` interface needs to include the `tag` # parameter of the `add_scalar` interface. if __name__ == '__main__': # Record the data of the first experiment with LogWriter('./log/hparams_test/train/run1') as writer: # Record the value of `hparams` and the name of `metrics` writer.add_hparams(hparams_dict={'lr': 0.1, 'bsize': 1, 'opt': 'sgd'}, metrics_list=['hparam/accuracy', 'hparam/loss']) # Record the metrics values ​​of different steps in an experiment by matching # the `tag` in the `add_scalar` interface with `metrics_list` in `add_hparams` interface. for i in range(10): writer.add_scalar(tag='hparam/accuracy', value=i, step=i) writer.add_scalar(tag='hparam/loss', value=2*i, step=i) # Record the data of the second experiment with LogWriter('./log/hparams_test/train/run2') as writer: # Record the value of `hparams` and the name of `metrics` writer.add_hparams(hparams_dict={'lr': 0.2, 'bsize': 2, 'opt': 'relu'}, metrics_list=['hparam/accuracy', 'hparam/loss']) # Record the metrics values ​​of different steps in an experiment by matching # the `tag` in the `add_scalar` interface with `metrics_list` in `add_hparams` interface. for i in range(10): writer.add_scalar(tag='hparam/accuracy', value=1.0/(i+1), step=i) writer.add_scalar(tag='hparam/loss', value=5*i, step=i) ``` -------------------------------- ### Update VisualDL package Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Ensure the latest version of VisualDL is installed to access service features. ```bash pip install visualdl --upgrade ``` -------------------------------- ### Histogram Usage Example Source: https://visualdl.readthedocs.io/zh/latest/components/README.html A complete script demonstrating how to use LogWriter to record histogram data during a training loop. ```python from visualdl import LogWriter import numpy as np if __name__ == '__main__': values = np.arange(0, 1000) with LogWriter(logdir="./log/histogram_test/train") as writer: for index in range(1, 101): interval_start = 1 + 2 * index / 100.0 interval_end = 6 - 2 * index / 100.0 data = np.random.uniform(interval_start, interval_end, size=(10000)) writer.add_histogram(tag='default tag', values=data, step=index, buckets=10) ``` -------------------------------- ### Launch VisualDL via Command Line Source: https://visualdl.readthedocs.io/zh/latest/README.html Use these parameters to configure the VisualDL server host, port, and component visibility. ```bash visualdl --logdir --host --port --cache-timeout --language --public-path --api-only --component_tabs ``` -------------------------------- ### FastDeploy Server Launch Parameters Source: https://visualdl.readthedocs.io/zh/latest/components/fastdeploy_server/README.html Configuration parameters used when launching a FastDeploy server service. ```text server-name: The service name specified by the user, which is used to name the deployed service for subsequent viewing. If not filled, the default service name is the process number pid of the service process model-repository: The model repository to be deployed, which is the currently loaded model repository. backend-config: Specify the backend configuration of service, the format is ,=, where backend_name is the backend name, such as python, tensorrt, etc., followed by the specific configurable items of the backend. The default value is python, shm-default-byte-size=10485760 http-port: Specify the http service port of service, the default is 8000 grpc-port: Specify the grpc service port of service, the default is 8001 metrics-port: Specify the metrics query service port of service, the default is 8002 gpus: Specify the number of gpus that can be used by the deployed service. If card 2 and card 3 are used, it is "2,3". If not filled, all available gpus will be used ``` -------------------------------- ### add_image(tag, img, step, walltime=None, dataformats="HWC") Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Records an image to the log file for visualization during training. ```APIDOC ## add_image(tag, img, step, walltime=None, dataformats="HWC") ### Description Records image data to a log file to track changes during training stages. ### Parameters - **tag** (string) - Required - The name of the image data (e.g., 'train/loss'). Cannot contain '%'. - **img** (numpy.ndarray) - Required - Image data in ndarray format. Channels can be 1, 3, or 4. Floating point data is clipped to [0, 1). - **step** (int) - Required - The training step number. - **walltime** (int) - Optional - The timestamp of the data. Defaults to current time. - **dataformats** (string) - Optional - Format of the image (e.g., 'NCHW', 'NHWC', 'HWC', 'CHW', 'HW'). Defaults to 'HWC'. ``` -------------------------------- ### Collect and Export Profiling Data with PaddlePaddle Source: https://visualdl.readthedocs.io/zh/latest/components/profiler/README.html Demonstrates how to use the paddle.profiler API to capture training metrics within a specific step range and export them to a directory. ```python import paddle import paddle.profiler as profiler import paddle.nn.functional as F from paddle.vision.transforms import ToTensor import numpy as np transform = ToTensor() cifar10_train = paddle.vision.datasets.Cifar10(mode='train', transform=transform) cifar10_test = paddle.vision.datasets.Cifar10(mode='test', transform=transform) class MyNet(paddle.nn.Layer): def __init__(self, num_classes=1): super(MyNet, self).__init__() self.conv1 = paddle.nn.Conv2D(in_channels=3, out_channels=32, kernel_size=(3, 3)) self.pool1 = paddle.nn.MaxPool2D(kernel_size=2, stride=2) self.conv2 = paddle.nn.Conv2D(in_channels=32, out_channels=64, kernel_size=(3,3)) self.pool2 = paddle.nn.MaxPool2D(kernel_size=2, stride=2) self.conv3 = paddle.nn.Conv2D(in_channels=64, out_channels=64, kernel_size=(3,3)) self.flatten = paddle.nn.Flatten() self.linear1 = paddle.nn.Linear(in_features=1024, out_features=64) self.linear2 = paddle.nn.Linear(in_features=64, out_features=num_classes) def forward(self, x): x = self.conv1(x) x = F.relu(x) x = self.pool1(x) x = self.conv2(x) x = F.relu(x) x = self.pool2(x) x = self.conv3(x) x = F.relu(x) x = self.flatten(x) x = self.linear1(x) x = F.relu(x) x = self.linear2(x) return x epoch_num = 10 batch_size = 32 learning_rate = 0.001 val_acc_history = [] val_loss_history = [] def train(model): print('start training ... ') # turn into training mode model.train() opt = paddle.optimizer.Adam(learning_rate=learning_rate, parameters=model.parameters()) train_loader = paddle.io.DataLoader(cifar10_train, shuffle=True, batch_size=batch_size, num_workers=1) valid_loader = paddle.io.DataLoader(cifar10_test, batch_size=batch_size) # create profiler def my_on_trace_ready(prof): # callback function, will be called when profiler stops callback = profiler.export_chrome_tracing('./profiler_demo') # export profiling data callback(prof) prof.summary(sorted_by=profiler.SortedKeys.GPUTotal) # print summary p = profiler.Profiler(scheduler = [3,14], on_trace_ready=my_on_trace_ready, timer_only=False) p.start() # start profiler for epoch in range(epoch_num): for batch_id, data in enumerate(train_loader()): x_data = data[0] y_data = paddle.to_tensor(data[1]) y_data = paddle.unsqueeze(y_data, 1) logits = model(x_data) loss = F.cross_entropy(logits, y_data) if batch_id % 1000 == 0: print("epoch: {}, batch_id: {}, loss is: {}".format(epoch, batch_id, loss.numpy())) loss.backward() opt.step() opt.clear_grad() p.step() # signify profiler into next step if batch_id == 19: p.stop() # stop profiler exit() # evaluate model after one epoch model.eval() accuracies = [] losses = [] for batch_id, data in enumerate(valid_loader()): x_data = data[0] y_data = paddle.to_tensor(data[1]) y_data = paddle.unsqueeze(y_data, 1) logits = model(x_data) loss = F.cross_entropy(logits, y_data) acc = paddle.metric.accuracy(logits, y_data) accuracies.append(acc.numpy()) losses.append(loss.numpy()) avg_acc, avg_loss = np.mean(accuracies), np.mean(losses) print("[validation] accuracy/loss: {}/{}".format(avg_acc, avg_loss)) val_acc_history.append(avg_acc) val_loss_history.append(avg_loss) model.train() model = MyNet(num_classes=10) train(model) ``` -------------------------------- ### add_audio(tag, audio_array, step, sample_rate) Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Records audio data to the log writer for visualization in the VisualDL panel. ```APIDOC ## add_audio(tag, audio_array, step, sample_rate) ### Description Records audio data during the training process to monitor speech recognition or text-to-speech tasks. ### Parameters - **tag** (string) - Required - The name of the audio record (e.g., 'audio/sample'). Must not contain '%'. - **audio_array** (numpy.ndarray) - Required - Audio data in ndarray format. Elements must be float values normalized in the range [-1, 1]. - **step** (int) - Required - The current training step. - **sample_rate** (int) - Optional - The sample rate of the original audio. Defaults to 8000. ``` -------------------------------- ### Record Scalar Data with LogWriter Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Initializes a LogWriter to record accuracy and loss metrics during training. ```python from visualdl import LogWriter if __name__ == '__main__': value = [i/1000.0 for i in range(1000)] # initialize a recorder with LogWriter(logdir="./log/scalar_test/train") as writer: for step in range(1000): # add accuracy with tag of 'acc' to the recorder writer.add_scalar(tag="acc", step=step, value=value[step]) # add loss with tag of 'loss' to the recorder writer.add_scalar(tag="loss", step=step, value=1/(value[step] + 1)) ``` -------------------------------- ### Pull FastDeploy Docker Images Source: https://visualdl.readthedocs.io/zh/latest/components/fastdeploy_server/README.html Commands to download the required FastDeploy Docker images for CPU or GPU environments. ```bash docker pull registry.baidubce.com/paddlepaddle/fastdeploy:1.0.2-cpu-only-21.10 ``` ```bash docker pull registry.baidubce.com/paddlepaddle/fastdeploy:1.0.2-gpu-cuda11.4-trt8.4-21.10 ``` -------------------------------- ### Upload visualization data Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Upload log directories and model files to generate a shareable visualization URL. ```bash visualdl service upload --logdir ./log \ --model ./__model__ ``` -------------------------------- ### Audio Logging Interface Definition Source: https://visualdl.readthedocs.io/zh/latest/components/README.html The signature for the add_audio method used to record audio data. ```python add_audio(tag, audio_array, step, sample_rate) ``` -------------------------------- ### Image Recording Interface Source: https://visualdl.readthedocs.io/zh/latest/components/README.html The signature for the add_image method used to log image data to the log file. ```python add_image(tag, img, step, walltime=None, dataformats="HWC") ``` -------------------------------- ### Record scalar values with LogWriter Source: https://visualdl.readthedocs.io/zh/latest/README.html Initialize a LogWriter and record scalar values to a log file using the add_scalar method. ```python from visualdl import LogWriter # create a log file under `./log/scalar_test/train` with LogWriter(logdir="./log/scalar_test/train") as writer: # use `add_scalar` to record scalar values writer.add_scalar(tag="acc", step=1, value=0.5678) writer.add_scalar(tag="acc", step=2, value=0.6878) writer.add_scalar(tag="acc", step=3, value=0.9878) ``` -------------------------------- ### Model Configuration Attributes Source: https://visualdl.readthedocs.io/zh/latest/components/fastdeploy_server/README.html Definitions for configurable attributes in the model configuration editor, including maxBatchSize, instanceGroup, and optimization. ```text maxBatchSize: The maximum batch size allowed in inference. Please enter a non-negative integer, such as 16 instanceGroup: Set hardware resources the server uses and how many instances are deployed. It contains three configurable items, count represents the number of deployed instances, please enter a non-negative integer, such as 2. kind indicates the type of device used, and you can choose KIND_CPU to indicate the use of CPU or KIND_GPU to indicate the use of GPU. When KIND_GPU is selected, gpus indicates that the GPU card numbers need to be used, please enter multiple integers separated by commas (,), such as using cards 2 and 3, i.e. 2,3 optimization: Set the configuration of execution acceleration, you can configure the acceleration configuration of cpu and gpu separately. It contains the name of the backend, such as onnxruntime, and parameters related to the backend. The first text is filled with the parameter name, such as cpu_threads, and the second text is filled with the parameter value, such as 4 ``` -------------------------------- ### add_graph(model, input_spec, verbose=False) Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Records the model structure for visualization in the VisualDL Graph panel. ```APIDOC ## add_graph(model, input_spec, verbose=False) ### Description Records the dynamic model structure to be visualized in the VisualDL Graph panel. ### Parameters - **model** (paddle.nn.Layer) - Required - The dynamic model of paddle. - **input_spec** (list[paddle.static.InputSpec|Tensor]) - Required - Describes the input of the saved model's forward arguments. - **verbose** (bool) - Optional - Whether to print graph statistic information in the console. ``` -------------------------------- ### LogWriter Source: https://visualdl.readthedocs.io/zh/latest/README.html The LogWriter class is the primary interface for initializing a logger to record training information. It supports configuration for log directories, caching behavior, and file naming. ```APIDOC ## class LogWriter(logdir=None, comment='', max_queue=10, flush_secs=120, filename_suffix='', write_to_disk=True, **kwargs) ### Description Initializes a logger to record training process data into a log file. ### Parameters - **logdir** (string) - Optional - The path location of the log file. Defaults to `runs/${CURRENT_TIME}`. - **comment** (string) - Optional - Suffix for the log folder name if logdir is not specified. - **max_queue** (int) - Optional - Maximum capacity of data before writing to disk. Default is 10. - **flush_secs** (int) - Optional - Maximum cache time in seconds before writing to disk. Default is 120. - **filename_suffix** (string) - Optional - Suffix for the default log file name. - **write_to_disk** (boolean) - Optional - Whether to write data to disk. - **display_name** (string) - Optional - Custom name for the run. ### Example ```python from visualdl import LogWriter with LogWriter(logdir="./log/scalar_test/train") as writer: writer.add_scalar(tag="acc", step=1, value=0.5678) ``` ``` -------------------------------- ### add_histogram(tag, values, step, walltime=None, buckets=10) Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Records a histogram of tensor data for a specific training step. ```APIDOC ## add_histogram ### Description Records the distribution of tensor data (weights, biases, gradients) to be visualized as a histogram in the VisualDL panel. ### Signature `add_histogram(tag, values, step, walltime=None, buckets=10)` ### Parameters - **tag** (string) - Required - The name of the data series (e.g., 'train/loss'). Cannot contain '%'. - **values** (numpy.ndarray or list) - Required - The tensor data to record, expected shape is (N, ). - **step** (int) - Required - The current training step. - **walltime** (int) - Optional - The timestamp of the data. Defaults to current time. - **buckets** (int) - Optional - The number of segments to generate the histogram. Defaults to 10. ### Usage Example ```python from visualdl import LogWriter import numpy as np with LogWriter(logdir="./log") as writer: data = np.random.uniform(0, 1, size=(10000)) writer.add_histogram(tag='layer1/weights', values=data, step=1) ``` ``` -------------------------------- ### Record Scalar Interface Source: https://visualdl.readthedocs.io/zh/latest/components/README.html The primary interface for logging scalar data points during training. ```python add_scalar(tag, value, step, walltime=None) ``` -------------------------------- ### Compare Multiple Experiments with Scalar Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Records data from multiple experiments using the same tags to enable side-by-side comparison in the UI. ```python from visualdl import LogWriter if __name__ == '__main__': value = [i/1000.0 for i in range(1000)] # Step 1: Create a parent folder: log and a child folder: scalar_test with LogWriter(logdir="./log/scalar_test") as writer: for step in range(1000): # Step 2: Add data with tag train/acc to the recorder writer.add_scalar(tag="train/acc", step=step, value=value[step]) # Step 2: Add data with tag train/loss to the recorder writer.add_scalar(tag="train/loss", step=step, value=1/(value[step] + 1)) # Step 1: Create a second child folder: scalar_test2 value = [i/500.0 for i in range(1000)] with LogWriter(logdir="./log/scalar_test2") as writer: for step in range(1000): # Step 2: Add the accuracy data of scalar_test2 under the same name `train/acc` writer.add_scalar(tag="train/acc", step=step, value=value[step]) # Step 2: Add the loss data of scalar_test2 under the same name as `train/loss` writer.add_scalar(tag="train/loss", step=step, value=1/(value[step] + 1)) ``` -------------------------------- ### Define add_graph interface Source: https://visualdl.readthedocs.io/zh/latest/components/README.html The interface signature for adding a model graph to the VisualDL log. ```python add_graph(model, input_spec, verbose=False): ``` -------------------------------- ### add_hparams(hparam_dict, metric_list, walltime=None) Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Records hyperparameter data and specifies the names of metrics to be tracked for a specific experiment. ```APIDOC ## add_hparams ### Description Records the hyperparameter configuration and the list of metrics that will be tracked for the experiment. Metrics specified here must match the tags used in subsequent add_scalar calls. ### Parameters - **hparam_dict** (dict) - Required - A dictionary containing the names and values of the hyperparameters. - **metric_list** (list) - Required - A list of metric names (strings) that correspond to the 'tag' parameter in the add_scalar interface. - **walltime** (int) - Optional - The timestamp for the data record. Defaults to the current timestamp. ``` -------------------------------- ### Histogram Record Interface Source: https://visualdl.readthedocs.io/zh/latest/components/README.html The function signature for adding histogram data to the log. ```python add_histogram(tag, values, step, walltime=None, buckets=10) ``` -------------------------------- ### LogWriter class definition Source: https://visualdl.readthedocs.io/zh/latest/README.html The constructor signature for the LogWriter class used to initialize the logging backend. ```python class LogWriter(logdir=None, comment='', max_queue=10, flush_secs=120, filename_suffix='', write_to_disk=True, **kwargs) ``` -------------------------------- ### Define add_hparams interface Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Signature for the add_hparams method used to initialize hyperparameter tracking. ```python add_hparams(hparam_dict, metric_list, walltime=None): ``` -------------------------------- ### add_scalar(tag, value, step, walltime=None) Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Records a scalar value to be displayed in a line chart. ```APIDOC ## add_scalar(tag, value, step, walltime=None) ### Description Records a scalar value for tracking training parameters. The data is visualized as a line chart. ### Parameters - **tag** (string) - Required - The name of the scalar data (e.g., 'train/loss'). Cannot contain '%'. - **value** (float) - Required - The data value to record. - **step** (int) - Required - The training step index. - **walltime** (int) - Optional - The timestamp of the data. Defaults to the current time. ``` -------------------------------- ### add_embeddings(tag, labels, hot_vectors, labels_meta=None, walltime=None) Source: https://visualdl.readthedocs.io/zh/latest/components/README.html Records high-dimensional data (hot_vectors) associated with specific labels to the log writer for dimensionality reduction analysis. ```APIDOC ## add_embeddings ### Description Records a set of labels and corresponding hot_vectors to the recorder for high-dimensional data analysis. ### Parameters - **tag** (string) - Required - The name of the high dimensional data (cannot contain '%'). - **labels** (numpy.array or list) - Required - The label of hot_vectors. Shape should be (N,) or (M, N). - **hot_vectors** (numpy.array or list) - Required - Features corresponding to the tag and label. - **labels_meta** (numpy.array or list) - Optional - Metadata corresponding to labels. Defaults to '__metadata__'. - **walltime** (int) - Optional - Timestamp of the data. Defaults to current time. ``` -------------------------------- ### Record High Dimensional Data Interface Source: https://visualdl.readthedocs.io/zh/latest/components/README.html The signature for the add_embeddings method used to record high-dimensional data. ```python add_embeddings(tag, labels, hot_vectors, walltime=None) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.