mirror of
https://github.com/clearml/clearml-docs
synced 2025-06-22 17:56:07 +00:00
Add artifact upload format options (#249)
This commit is contained in:
parent
26335830a0
commit
2db95bbf3f
@ -13,7 +13,8 @@ A few examples of artifacts are:
|
|||||||
|
|
||||||
## Artifacts
|
## Artifacts
|
||||||
### Logging Artifacts
|
### Logging Artifacts
|
||||||
To log any type of artifact to a Task, use the `upload_artifact()` method. For example:
|
To log any type of artifact to a Task, use the [`upload_artifact`](../references/sdk/task.md#upload_artifact) method.
|
||||||
|
For example:
|
||||||
|
|
||||||
* Upload a local file containing the preprocessing results of the data.
|
* Upload a local file containing the preprocessing results of the data.
|
||||||
```python
|
```python
|
||||||
@ -24,12 +25,27 @@ task.upload_artifact(name='data', artifact_object='/path/to/preprocess_data.csv'
|
|||||||
```python
|
```python
|
||||||
task.upload_artifact(name='folder', artifact_object='/path/to/folder/')
|
task.upload_artifact(name='folder', artifact_object='/path/to/folder/')
|
||||||
```
|
```
|
||||||
* Upload an instance of an object, Numpy / Pandas / PIL (converted to npz / csv.gz / jpg formats accordingly). If the
|
* Serialize and upload a Python object. ClearML automatically chooses the file format based on the object’s type, or you
|
||||||
object type is unknown, it is pickled and uploaded.
|
can explicitly specify the format as follows:
|
||||||
```python
|
* dict - `.json` (default), `.yaml`
|
||||||
person_dict = {'name': 'Erik', 'age': 30}
|
* pandas.DataFrame - `.csv.gz` (default), `.parquet`, `.feather`, `.pickle`
|
||||||
task.upload_artifact(name='person dictionary', artifact_object=person_dict)
|
* numpy.ndarray - `.npz` (default), `.csv.gz`
|
||||||
```
|
* PIL.Image - Any PIL-supported extensions (default `.png`)
|
||||||
|
|
||||||
|
For example:
|
||||||
|
```python
|
||||||
|
person_dict = {'name': 'Erik', 'age': 30}
|
||||||
|
|
||||||
|
# upload as JSON artifact
|
||||||
|
task.upload_artifact(name='person dictionary json', artifact_object=person_dict)
|
||||||
|
|
||||||
|
# upload as YAML artifact
|
||||||
|
task.upload_artifact(
|
||||||
|
name='person dictionary yaml',
|
||||||
|
artifact_object=person_dict,
|
||||||
|
extension_name="yaml"
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
See more details in the artifacts [example](../guides/reporting/artifacts.md).
|
See more details in the artifacts [example](../guides/reporting/artifacts.md).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user