Skip to content

Commit

Permalink
dev(narugo): fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
narugo1992 committed Dec 19, 2024
1 parent 8d57a80 commit 323131b
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cheesechaser/datapool/gelbooru.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def __init__(self, revision: str = 'main', hf_token: Optional[str] = None):
:param revision: The revision of the dataset to use, defaults to 'main'.
:type revision: str
:param hf_token: Hugging Face authentication token, defaults to None.
:type hf_token: Optional[str]
"""
IncrementIDDataPool.__init__(
self,
Expand Down
5 changes: 4 additions & 1 deletion cheesechaser/datapool/rule34.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ class Rule34DataPool(IncrementIDDataPool):
the images are stored in a directory structure with 4 levels of subdirectories.
"""

def __init__(self, revision: str = 'main'):
def __init__(self, revision: str = 'main', hf_token: Optional[str] = None):
"""
Initialize the Rule34DataPool.
:param revision: The revision of the dataset to use, defaults to 'main'.
:type revision: str
:param hf_token: Hugging Face authentication token, defaults to None.
:type hf_token: Optional[str]
"""
IncrementIDDataPool.__init__(
self,
Expand All @@ -54,6 +56,7 @@ def __init__(self, revision: str = 'main'):
idx_repo_id=_RULE34_REPO,
idx_revision=revision,
base_level=[3, 4],
hf_token=hf_token,
)


Expand Down
5 changes: 4 additions & 1 deletion cheesechaser/datapool/safebooru.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ class SafebooruDataPool(IncrementIDDataPool):
the images are stored in a directory structure with 4 levels of subdirectories.
"""

def __init__(self, revision: str = 'main'):
def __init__(self, revision: str = 'main', hf_token: Optional[str] = None):
"""
Initialize the SafebooruDataPool.
:param revision: The revision of the dataset to use, defaults to 'main'.
:type revision: str
:param hf_token: Hugging Face authentication token, defaults to None.
:type hf_token: Optional[str]
"""
IncrementIDDataPool.__init__(
self,
Expand All @@ -54,6 +56,7 @@ def __init__(self, revision: str = 'main'):
idx_repo_id=_GELBOORU_REPO,
idx_revision=revision,
base_level=[3, 4],
hf_token=hf_token,
)


Expand Down
42 changes: 42 additions & 0 deletions cheesechaser/datapool/sankaku.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
"""
This module provides data pool classes for accessing Sankaku image data.
It contains two classes:
1. SankakuDataPool: For accessing the full Sankaku dataset.
2. SankakuWebpDataPool: For accessing the WebP-formatted Sankaku dataset with 4M pixel images.
Both classes inherit from IncrementIDDataPool and provide easy access to the respective datasets
stored in Hugging Face repositories. These classes simplify the process of retrieving and working
with Sankaku image data, allowing users to easily integrate this data into their projects or
research.
.. note::
The datasets `deepghs/sankaku_full <https://huggingface.co/datasets/deepghs/sankaku_full>`_ and
`deepghs/sankaku-webp-4Mpixel <https://huggingface.co/datasets/deepghs/sankaku-webp-4Mpixel>`_
is gated, you have to get the access of it before using this module.
"""

import os.path
from collections import defaultdict
from threading import Lock
Expand All @@ -13,7 +32,30 @@


class SankakuDataPool(IncrementIDDataPool):
"""
A data pool class for accessing the full Sankaku dataset.
This class inherits from IncrementIDDataPool and is configured to access
the full Sankaku dataset stored in the 'deepghs/sankaku_full' repository.
It provides methods to retrieve image data based on image IDs.
:param revision: The revision of the dataset to use, defaults to 'main'.
:type revision: str
Note:
This class uses a base level of 4 for file organization, which means
the images are stored in a directory structure with 4 levels of subdirectories.
"""

def __init__(self, revision: str = 'main', hf_token: Optional[str] = None):
"""
Initialize the SankakuDataPool.
:param revision: The revision of the dataset to use, defaults to 'main'.
:type revision: str
:param hf_token: Hugging Face authentication token, defaults to None.
:type hf_token: Optional[str]
"""
IncrementIDDataPool.__init__(
self,
data_repo_id=_SANKAKU_REPO,
Expand Down
1 change: 1 addition & 0 deletions docs/source/api_doc/datapool/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ cheesechaser.datapool
realbooru
rule34
safebooru
sankaku
table
threedbooru
yande
Expand Down
24 changes: 24 additions & 0 deletions docs/source/api_doc/datapool/sankaku.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cheesechaser.datapool.sankaku
========================================================

.. currentmodule:: cheesechaser.datapool.sankaku

.. automodule:: cheesechaser.datapool.sankaku


SankakuDataPool
-----------------------------------------------------

.. autoclass:: SankakuDataPool
:members: __doc__,__init__,__module__



SankakuWebpDataPool
-----------------------------------------------------

.. autoclass:: SankakuWebpDataPool
:members: __doc__,__init__,__module__



0 comments on commit 323131b

Please sign in to comment.