praeclarumjj3 commited on
Commit
79b40c3
1 Parent(s): de5b705

Compile Worked, fix path data

Browse files
Files changed (2) hide show
  1. gradio_app.py +0 -3
  2. oneformer/data/tokenizer.py +5 -4
gradio_app.py CHANGED
@@ -1,7 +1,4 @@
1
- import subprocess
2
  import torch
3
- if torch.cuda.is_available():
4
- subprocess.run('sh deform_setup.sh', shell=True)
5
 
6
  print("Installed the dependencies!")
7
 
 
 
1
  import torch
 
 
2
 
3
  print("Installed the dependencies!")
4
 
oneformer/data/tokenizer.py CHANGED
@@ -40,7 +40,7 @@ import torch
40
  @lru_cache()
41
  def default_bpe():
42
  url = 'https://github.com/SHI-Labs/OneFormer/blob/main/oneformer/data/bpe_simple_vocab_16e6.txt.gz'
43
- wget.download(url, os.path.dirname(os.path.abspath(__file__)))
44
  # inmemory = StringIO(urlopen(url).read())
45
  # return inmemory
46
  return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'bpe_simple_vocab_16e6.txt.gz')
@@ -129,9 +129,10 @@ class SimpleTokenizer(object):
129
  def __init__(self, bpe_path: str = default_bpe()):
130
  self.byte_encoder = bytes_to_unicode()
131
  self.byte_decoder = {v: k for k, v in self.byte_encoder.items()}
132
-
133
- # merges = gzip.GzipFile(fileobj=bpe_path, mode='rb')
134
-
 
135
  merges = gzip.open(bpe_path).read().decode('utf-8').split('\n')
136
  merges = merges[1:49152 - 256 - 2 + 1]
137
  merges = [tuple(merge.split()) for merge in merges]
 
40
  @lru_cache()
41
  def default_bpe():
42
  url = 'https://github.com/SHI-Labs/OneFormer/blob/main/oneformer/data/bpe_simple_vocab_16e6.txt.gz'
43
+ wget.download(url, out=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'bpe_simple_vocab_16e6.txt.gz'))
44
  # inmemory = StringIO(urlopen(url).read())
45
  # return inmemory
46
  return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'bpe_simple_vocab_16e6.txt.gz')
 
129
  def __init__(self, bpe_path: str = default_bpe()):
130
  self.byte_encoder = bytes_to_unicode()
131
  self.byte_decoder = {v: k for k, v in self.byte_encoder.items()}
132
+
133
+ print("-----------\n")
134
+ print(bpe_path)
135
+ print("-----------\n")
136
  merges = gzip.open(bpe_path).read().decode('utf-8').split('\n')
137
  merges = merges[1:49152 - 256 - 2 + 1]
138
  merges = [tuple(merge.split()) for merge in merges]