mirror of
https://github.com/clearml/clearml-docs
synced 2025-03-03 10:42:51 +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
|
||||
### 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.
|
||||
```python
|
||||
@ -24,12 +25,27 @@ task.upload_artifact(name='data', artifact_object='/path/to/preprocess_data.csv'
|
||||
```python
|
||||
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
|
||||
object type is unknown, it is pickled and uploaded.
|
||||
```python
|
||||
person_dict = {'name': 'Erik', 'age': 30}
|
||||
task.upload_artifact(name='person dictionary', artifact_object=person_dict)
|
||||
```
|
||||
* Serialize and upload a Python object. ClearML automatically chooses the file format based on the object’s type, or you
|
||||
can explicitly specify the format as follows:
|
||||
* dict - `.json` (default), `.yaml`
|
||||
* pandas.DataFrame - `.csv.gz` (default), `.parquet`, `.feather`, `.pickle`
|
||||
* 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).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user