Giter Club home page Giter Club logo

Comments (7)

NivekT avatar NivekT commented on August 18, 2024 1

@NivekT

IIUC, HTTPRespond and GDriveRespond should also be wrapped by StreamWrapper

Yea, I believe they should, and they should still work as intended given that StreamWrapper delegates the method to the underlying object.

from data.

ejguan avatar ejguan commented on August 18, 2024 1

Another thing I want to mention is unified API would help us to implement downstream DataPipe:

  • Downloader
  • Extractor

These DataPipes are going to take file handle (stream) as input and yield either a filename or a new file stream. A unified API would help us to implement function to read data from streams.

from data.

ejguan avatar ejguan commented on August 18, 2024 1

You are right with Saver. I am talking about reading data from file stream. The current workflow is:

urls = IterableWrapper([URL])
fd = urls.open_url() # File handles
data = fd.map(fn=lambda x: x.read(), input_col=1) # <- This one is referred as Downloader in my mind
file = data.save_to_disk()

We can let user to do any map function to download data from file handle. But, if we are going to implement a DataPipe to do the same thing, we need to make sure all file handles (streams) sent to this DataPipe can be read.

The reason that I prefer a read method is the stream type varies:

  • String: ".join(fd)"
  • Bytes: b"".join(fd)

from data.

ejguan avatar ejguan commented on August 18, 2024 1

In the case of Extractor or Decompressor the yielded file handle should also be wrapped by the Wrapper to make sure fd is closed automatically and have a unified API like read

from data.

ejguan avatar ejguan commented on August 18, 2024

@NivekT

IIUC, HTTPRespond and GDriveRespond should also be wrapped by StreamWrapper

from data.

NivekT avatar NivekT commented on August 18, 2024

Another thing I want to mention is unified API would help us to implement downstream DataPipe:

  • Downloader
  • Extractor

These DataPipes are going to take file handle (stream) as input and yield either a filename or a new file stream. A unified API would help us to implement function to read data from streams.

Doesn't Saver already take in a stream (IOBase) as input and yield a filename? How will Downloader be different?
Maybe Downloader can be the combination of HttpReader and Saver (URL -> Filename)?

For Extractor, will it be similar to what Decompressor does in TorchVision?

https://github.com/pytorch/vision/blob/7b1b68d7142aa2070a5592d7c1a3bff3485b5ec1/torchvision/prototype/datasets/utils/_internal.py#L243

from data.

ejguan avatar ejguan commented on August 18, 2024

Closing this Issue as the Wrapper has landed.

from data.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.