Skip to content

Commit

Permalink
dev(narugo): add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
narugo1992 committed Sep 9, 2024
1 parent 03d097f commit dd8eb81
Showing 1 changed file with 46 additions and 6 deletions.
52 changes: 46 additions & 6 deletions cheesechaser/datapool/anime_pictures.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
"""
This module provides a data pool implementation for anime pictures.
This module provides data pool implementations for anime pictures.
It defines a class `AnimePicturesDataPool` which inherits from `IncrementIDDataPool`.
This class is designed to manage and access a repository of anime pictures,
utilizing an incremental ID system for efficient data retrieval.
It defines two classes:
1. `AnimePicturesDataPool`: Manages and accesses a repository of anime pictures.
2. `AnimePicturesWebpDataPool`: Manages and accesses a repository of WebP-formatted anime pictures.
Both classes inherit from `IncrementIDDataPool` and utilize an incremental ID system
for efficient data retrieval.
.. note::
The dataset `deepghs/anime_pictures_full <https://huggingface.co/datasets/deepghs/anime_pictures_full>`_
is gated, you have to get the access of it before using this module.
The datasets used by these classes are gated. You must have access to the
respective Hugging Face repositories before using this module:
- `deepghs/anime_pictures_full <https://huggingface.co/datasets/deepghs/anime_pictures_full>`_
- `deepghs/anime_pictures-webp-4Mpixel <https://huggingface.co/datasets/deepghs/anime_pictures-webp-4Mpixel>`_
"""

from typing import Optional
Expand Down Expand Up @@ -65,7 +72,40 @@ def __init__(self, revision: str = 'main', hf_token: Optional[str] = None):


class AnimePicturesWebpDataPool(IncrementIDDataPool):
"""
A data pool class for managing and accessing WebP-formatted anime pictures.
This class extends the IncrementIDDataPool to provide specific functionality
for handling WebP-formatted anime picture data. It uses a predefined repository
for storing and retrieving these pictures.
:param revision: The revision of the data to use, defaults to 'main'.
:type revision: str
:param hf_token: Optional Hugging Face token for authentication, defaults to None.
:type hf_token: Optional[str]
Usage:
>>> pool = AnimePicturesWebpDataPool()
>>> pool = AnimePicturesWebpDataPool(revision='main')
>>> pool = AnimePicturesWebpDataPool(revision='main', hf_token='your_hf_token')
.. note::
The class uses the same repository for both data and index storage.
The pictures in this pool are in WebP format and have a maximum size of 4 megapixels.
"""

def __init__(self, revision: str = 'main', hf_token: Optional[str] = None):
"""
Initialize the AnimePicturesWebpDataPool.
This method sets up the data pool by calling the parent class constructor
with specific parameters for the WebP-formatted anime pictures repository.
:param revision: The revision of the data to use, defaults to 'main'.
:type revision: str
:param hf_token: Optional Hugging Face token for authentication, defaults to None.
:type hf_token: Optional[str]
"""
IncrementIDDataPool.__init__(
self,
data_repo_id=_ANIME_PICTURES_WEBP_REPO,
Expand Down

0 comments on commit dd8eb81

Please sign in to comment.