unitorch.cli.writer¤
GeneralJsonlWriter¤
Tip
core/writer/jsonl
is the section for configuration of GeneralJsonlWriter.
Bases: GenericWriter
Class for writing data in JSONL format.
Initialize GeneralJsonlWriter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_file |
str
|
The path to the output file. |
required |
nrows_per_sample |
int
|
The number of rows per sample. Defaults to None. |
None
|
header |
bool
|
Whether to include a header in the output file. Defaults to None. |
None
|
columns |
List[str]
|
The list of columns to include in the output file. Defaults to None. |
None
|
Source code in src/unitorch/cli/writers/__init__.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
from_core_configure
classmethod
¤
from_core_configure(config, **kwargs)
Create an instance of GeneralJsonlWriter from a core configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
The core configuration. |
required | |
**kwargs |
Additional keyword arguments. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
GeneralJsonlWriter |
An instance of GeneralJsonlWriter. |
Source code in src/unitorch/cli/writers/__init__.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
process_chunk ¤
process_chunk(outputs: WriterOutputs)
Process a chunk of data during the writing process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outputs |
WriterOutputs
|
The writer outputs. |
required |
Source code in src/unitorch/cli/writers/__init__.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
process_end ¤
process_end()
Process the end of the writing process.
Source code in src/unitorch/cli/writers/__init__.py
97 98 99 |
|
process_start ¤
process_start(outputs: WriterOutputs)
Process the start of the writing process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outputs |
WriterOutputs
|
The writer outputs. |
required |
Source code in src/unitorch/cli/writers/__init__.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|