From 5a73108763b92de7958e04d231de0758f7141511 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Georges=20Lorr=C3=A9?=
<35808396+GeorgesLorre@users.noreply.github.com>
Date: Tue, 30 Jan 2024 16:20:40 +0100
Subject: [PATCH] Fix component readme generation (#828)
---
components/caption_images/README.md | 2 +-
components/load_from_hf_hub/README.md | 12 ++++++------
components/write_to_hf_hub/README.md | 12 ++++++------
scripts/component_readme/generate_readme.py | 3 +--
4 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/components/caption_images/README.md b/components/caption_images/README.md
index 1ba005318..2158b173b 100644
--- a/components/caption_images/README.md
+++ b/components/caption_images/README.md
@@ -49,7 +49,7 @@ pipeline = Pipeline(...)
dataset = pipeline.read(...)
dataset = dataset.apply(
- "",
+ "caption_images",
arguments={
# Add arguments
# "model_id": "Salesforce/blip-image-captioning-base",
diff --git a/components/load_from_hf_hub/README.md b/components/load_from_hf_hub/README.md
index 6f2a3a0f1..41ad7ade6 100644
--- a/components/load_from_hf_hub/README.md
+++ b/components/load_from_hf_hub/README.md
@@ -1,20 +1,20 @@
# Load from Hugging Face hub
-
+
## Description
Component that loads a dataset from the hub
-
+
## Inputs / outputs
-
+
### Consumes
**This component does not consume data.**
-
+
### Produces
**This component can produce additional fields**
@@ -24,7 +24,7 @@ The keys are the names of the fields to be produced by the component, while the
the type of the field that should be used to write the output dataset.
-
+
## Arguments
The component takes the following arguments to alter its behavior:
@@ -37,7 +37,7 @@ The component takes the following arguments to alter its behavior:
| n_rows_to_load | int | Optional argument that defines the number of rows to load. Useful for testing pipeline runs on a small scale | / |
| index_column | str | Column to set index to in the load component, if not specified a default globally unique index will be set | / |
-
+
## Usage
You can add this component to your pipeline using the following code:
diff --git a/components/write_to_hf_hub/README.md b/components/write_to_hf_hub/README.md
index b207772ad..327eafb8a 100644
--- a/components/write_to_hf_hub/README.md
+++ b/components/write_to_hf_hub/README.md
@@ -1,13 +1,13 @@
# Write to Hugging Face hub
-
+
## Description
Component that writes a dataset to the hub
-
+
## Inputs / outputs
-
+
### Consumes
**This component can consume additional fields**
@@ -21,13 +21,13 @@ See the usage example below on how to define a field name for additional fields.
-
+
### Produces
**This component does not produce data.**
-
+
## Arguments
The component takes the following arguments to alter its behavior:
@@ -40,7 +40,7 @@ The component takes the following arguments to alter its behavior:
| image_column_names | list | A list containing the image column names. Used to format to image to HF hub format | / |
| column_name_mapping | dict | Mapping of the consumed fondant column names to the written hub column names | / |
-
+
## Usage
You can add this component to your pipeline using the following code:
diff --git a/scripts/component_readme/generate_readme.py b/scripts/component_readme/generate_readme.py
index b26953ee2..1ba499dc5 100644
--- a/scripts/component_readme/generate_readme.py
+++ b/scripts/component_readme/generate_readme.py
@@ -2,7 +2,6 @@
from pathlib import Path
import jinja2
-
from fondant.core.component_spec import ComponentSpec
@@ -19,7 +18,7 @@ def generate_readme(component_spec: ComponentSpec, *, component_dir: Path) -> st
template = env.get_template("readme_template.md")
return template.render(
- component_id=component_spec.safe_name,
+ component_id=component_dir.name,
name=component_spec.name,
description=component_spec.description,
consumes=component_spec.consumes,