serialization
load_from_dict(template)
¶
Reads a template (a class serialized) and returns a the instance contained.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template |
Dict[str, Any]
|
Dict containing the template, the dict serialized. |
required |
Returns:
Type | Description |
---|---|
Generic[T]
|
Generic[T]: Instance contained in the template |
Source code in src/distilabel/utils/serialization.py
load_task_from_disk(path)
¶
Loads a task from disk.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
PathLike
|
The path to the task. |
required |
Returns:
Name | Type | Description |
---|---|---|
Task |
Task
|
The task. |
Source code in src/distilabel/utils/serialization.py
read_json(filename)
¶
Read a json file from disk.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
Path
|
Name of the json file. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
Dict[str, Any]: Dict containing the json data. |
Source code in src/distilabel/utils/serialization.py
write_json(filename, data)
¶
Writes a json file to the given path, creates the parent dir.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
Path
|
Name of the file. |
required |
data |
Dict[str, Any]
|
Dict to be written as json. |
required |