Skip to content

Commit

Permalink
Payload Implementation (#828)
Browse files Browse the repository at this point in the history
* add payloads and its basic operations in DataStore and DataPack

* docstring fix

* add implementation of payload with interface for users writing their own loading method

* minor fix

* add audio payload test example

* move SoundfileAudioPayload out

* add Meta

* add the logic of adding meta

* add more meta adding in DataStore

* rewrite audio reader and processor to adapt the new Payload design

* new Payload stores loading_function and loading_path and add Meta class and its subclasses to store data processing related metadata

* temporarily import Meta inside the class as there is another Meta class inside the script

* remove import Meta inside DataPack class

* no changes

* allow users to pass None to pack so that Entry won't be added to DataPack

* pass None as pack to AudioProcessingMeta so that AudioProcessingMeta doesn't need to be added into any DataPack

* remove Meta importing

* pylint fix: fix imports

* make Payload class variables private

* remove initialized DataPack

* Delete payload_test.py

* new cache and meta for payload

* new reader test based on code changes

* pass reader configs(reading method) to AudioPayload and AudioReadingMeta

* parse reading configs into a reading function

* reconstruct reading meta which is bound to payload

* rewrite set text function and set audio function

* clean up unnecessary class variables and add TextReadingMeta

* test ImagePayload

* get_single with payload index

* keep reading meta in the payload

* initialize metadata in payload

* ReadingMeta datastore

* remove meta_name

* payload_index -> entry_index

* docstring for get_single

* add payload ontology

* remote text, audio property and get_image_array function and remove ReadingMeta

* remove payload ontology

* remove ReadingMeta

* remove reading meta

* add enum modality

* payload cache

* add docstring for payload_index

* payload_index docstring

* add docstring for payload related functions

* remove unused method

* get_payload_at() and DataPack.payloads of three modalities

* remove payloads of different modalities

* AudioReadingMeta -> Generics

* add payload ontologies of three modalities

* update generated base ontology classes

* DataPack.audio -> pack.get_payload_data_at(audio, 0)

* DataPack.audio -> input_pack.get_payload_at(audio, 0)

* adapt Modality parameter and audio -> get_payload_at(audio) in tests/forte/image_annotation_test.py

* add payload operations in data store

* add enum

* get around an no-key-found issue with conditional popping state key

* add modality imports in forte.data init

* import IntEnum

* update text operation based on TextPayload

* Payload serialization function

* Payload DataStore

* import Modality

* payload ontology json

* payload ontology classes

* remove Modality import

* revert changes in  tests/forte/data/readers/audio_reader_test.py

* update grid tests based on the new Payload

* update test based on new Payload for tests/forte/image_annotation_test.py

* update generics count due to its function as Payload Meta data

* modality class

* revert changes in get_single()

* revert changes in get_single()

* pylint fix

* pylint

* pylint

* pylint

* pylint

* pylint

* pylint

* mypy

* update base ontology

* pylint

* remove enum installation as it's built-in

* fix doc build

* fix spelling

* add enum34

* remove meta data for payloads

* revert empty ontology initialization change

* adjust generics count and testing state.pop(_entry__pack)

* temporary fix

* remove unused Generics

* capitalize first character in Enum

* fix docstring for text() and change modality from str format to IntEnum

* change modality from str format to IntEnum

* change modality from str format to IntEnum

* change modality from str format to IntEnum

* change modality from str format to IntEnum

* change modality from str format to IntEnum

* change modality from str format to IntEnum

* correct text function

* entry converter with payload support

* cutomized payload serialization function

* add_payload_raw

* remove extra parameter Modality

* cast entry to Payload

* list to sequence

* remove extra paramater Modality

* datapack.set_Text

* remove extra imports

* remove extra paramter modality

* remove modality paramter

* remove duplication check for payload

* improve docstring for payload

* new ontology

* set Payload._modality based on Payload class type

* remove set_cache not needed

* set_cache -> set_audio

* change self.device back

* set_audio(audio_data, sample_rate)

* get_payload_data -> self.text

* fix modality

* get_modality -> modality property

* add_entry_raw for Payload

* remove unused imports

* remove modality parameter in ImagePayload

* Revert "remove modality parameter in ImagePayload"

This reverts commit 5aa6be0.

* correct ontology files

* revert base back changes

* kept base_pack.py unchanged

* correct docstring

* revert changes in unrelevant file

* revert metric.py changes

* remove unused import

* remove unused textpayload

* revert changes in audio reader
  • Loading branch information
hepengfe authored Jun 30, 2022
1 parent ae94e28 commit 8b233e4
Show file tree
Hide file tree
Showing 13 changed files with 646 additions and 173 deletions.
1 change: 1 addition & 0 deletions forte/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
from forte.data.data_store import *
from forte.data.selector import *
from forte.data.index import *
from forte.data.modality import *
Loading

0 comments on commit 8b233e4

Please sign in to comment.