Spaces:
Runtime error
Runtime error
Jitesh Jain
commited on
Commit
·
cd188a2
1
Parent(s):
79b40c3
Compile Worked, fix path data
Browse files- Dockerfile +19 -19
- oneformer/data/tokenizer.py +0 -9
Dockerfile
CHANGED
|
@@ -31,32 +31,32 @@ RUN chmod -R 777 $WORKDIR
|
|
| 31 |
|
| 32 |
COPY requirements.txt $WORKDIR/requirements.txt
|
| 33 |
COPY . .
|
| 34 |
-
|
| 35 |
|
| 36 |
-
RUN pip install --no-cache-dir --upgrade -r $WORKDIR/requirements.txt
|
| 37 |
|
| 38 |
-
ARG TORCH_CUDA_ARCH_LIST=7.5+PTX
|
| 39 |
|
| 40 |
|
| 41 |
-
RUN pip install ninja
|
| 42 |
|
| 43 |
-
USER root
|
| 44 |
-
RUN chown -R user:user /usr
|
| 45 |
-
RUN chmod -R 777 /usr
|
| 46 |
-
RUN chown -R user:user $HOME
|
| 47 |
-
RUN chmod -R 777 $HOME
|
| 48 |
-
RUN chown -R user:user $WORKDIR
|
| 49 |
-
RUN chmod -R 777 $WORKDIR
|
| 50 |
|
| 51 |
-
USER user
|
| 52 |
-
RUN ln -s $WORKDIR/oneformer/modeling/pixel_decoder/ops/ $WORKDIR/ && ls && cd ops/ && FORCE_CUDA=1 python setup.py build --build-base=$WORKDIR/ install --user && cd ..
|
| 53 |
-
RUN sh deform_setup.sh
|
| 54 |
|
| 55 |
-
USER user
|
| 56 |
-
RUN sh deform_setup.sh
|
| 57 |
|
| 58 |
-
USER user
|
| 59 |
|
| 60 |
-
EXPOSE 7860
|
| 61 |
|
| 62 |
-
ENTRYPOINT ["python", "gradio_app.py"]
|
|
|
|
| 31 |
|
| 32 |
COPY requirements.txt $WORKDIR/requirements.txt
|
| 33 |
COPY . .
|
| 34 |
+
RUN cd $WORKDIR/oneformer/data && ls
|
| 35 |
|
| 36 |
+
# RUN pip install --no-cache-dir --upgrade -r $WORKDIR/requirements.txt
|
| 37 |
|
| 38 |
+
# ARG TORCH_CUDA_ARCH_LIST=7.5+PTX
|
| 39 |
|
| 40 |
|
| 41 |
+
# RUN pip install ninja
|
| 42 |
|
| 43 |
+
# USER root
|
| 44 |
+
# RUN chown -R user:user /usr
|
| 45 |
+
# RUN chmod -R 777 /usr
|
| 46 |
+
# RUN chown -R user:user $HOME
|
| 47 |
+
# RUN chmod -R 777 $HOME
|
| 48 |
+
# RUN chown -R user:user $WORKDIR
|
| 49 |
+
# RUN chmod -R 777 $WORKDIR
|
| 50 |
|
| 51 |
+
# USER user
|
| 52 |
+
# RUN ln -s $WORKDIR/oneformer/modeling/pixel_decoder/ops/ $WORKDIR/ && ls && cd ops/ && FORCE_CUDA=1 python setup.py build --build-base=$WORKDIR/ install --user && cd ..
|
| 53 |
+
# RUN sh deform_setup.sh
|
| 54 |
|
| 55 |
+
# USER user
|
| 56 |
+
# RUN sh deform_setup.sh
|
| 57 |
|
| 58 |
+
# USER user
|
| 59 |
|
| 60 |
+
# EXPOSE 7860
|
| 61 |
|
| 62 |
+
# ENTRYPOINT ["python", "gradio_app.py"]
|
oneformer/data/tokenizer.py
CHANGED
|
@@ -24,8 +24,6 @@
|
|
| 24 |
# Modified by Jiarui Xu
|
| 25 |
# -------------------------------------------------------------------------
|
| 26 |
|
| 27 |
-
# from StringIO import StringIO
|
| 28 |
-
# from urllib import urlopen
|
| 29 |
import wget
|
| 30 |
import gzip
|
| 31 |
import html
|
|
@@ -41,11 +39,8 @@ import torch
|
|
| 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')
|
| 47 |
|
| 48 |
-
|
| 49 |
@lru_cache()
|
| 50 |
def bytes_to_unicode():
|
| 51 |
"""Returns list of utf-8 byte and a corresponding list of unicode strings.
|
|
@@ -129,10 +124,6 @@ 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 |
-
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]
|
|
|
|
| 24 |
# Modified by Jiarui Xu
|
| 25 |
# -------------------------------------------------------------------------
|
| 26 |
|
|
|
|
|
|
|
| 27 |
import wget
|
| 28 |
import gzip
|
| 29 |
import html
|
|
|
|
| 39 |
def default_bpe():
|
| 40 |
url = 'https://github.com/SHI-Labs/OneFormer/blob/main/oneformer/data/bpe_simple_vocab_16e6.txt.gz'
|
| 41 |
wget.download(url, out=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'bpe_simple_vocab_16e6.txt.gz'))
|
|
|
|
|
|
|
| 42 |
return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'bpe_simple_vocab_16e6.txt.gz')
|
| 43 |
|
|
|
|
| 44 |
@lru_cache()
|
| 45 |
def bytes_to_unicode():
|
| 46 |
"""Returns list of utf-8 byte and a corresponding list of unicode strings.
|
|
|
|
| 124 |
def __init__(self, bpe_path: str = default_bpe()):
|
| 125 |
self.byte_encoder = bytes_to_unicode()
|
| 126 |
self.byte_decoder = {v: k for k, v in self.byte_encoder.items()}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
merges = gzip.open(bpe_path).read().decode('utf-8').split('\n')
|
| 128 |
merges = merges[1:49152 - 256 - 2 + 1]
|
| 129 |
merges = [tuple(merge.split()) for merge in merges]
|