metadriverse / metadrive-scenario

This repo contains scenarios from different source for training and testing autonomous vehicles.
Apache License 2.0
20 stars 2 forks source link

Useful utility: auto download dataset #14

Open pengzhenghao opened 1 year ago

pengzhenghao commented 1 year ago

I come across snippet code downloading model automatically:

    def download_tokenizer(self):
        if self.is_verbose: print("downloading tokenizer params")
        suffix = '' if self.is_mega else '_mini'
        _ = requests.get(MIN_DALLE_REPO + 'config.json') # trigger HF download
        vocab = requests.get(MIN_DALLE_REPO + 'vocab{}.json'.format(suffix))
        merges = requests.get(MIN_DALLE_REPO + 'merges{}.txt'.format(suffix))
        with open(self.vocab_path, 'wb') as f: f.write(vocab.content)
        with open(self.merges_path, 'wb') as f: f.write(merges.content)

we can use this in this repo.

pengzhenghao commented 1 year ago

From here: https://github.com/kuprel/min-dalle/blob/main/min_dalle/min_dalle.py