Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker image #308

Open
Vincent-vst opened this issue Nov 15, 2022 · 4 comments
Open

docker image #308

Vincent-vst opened this issue Nov 15, 2022 · 4 comments

Comments

@Vincent-vst
Copy link

the command : docker build --tag gpt-2 -f Dockerfile.gpu .
return this :

Step 9/12 : RUN python3 download_model.py 124M
 ---> Running in afe900659249
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/certifi/core.py", line 14, in <module>
    from importlib.resources import path as get_path, read_text
ImportError: No module named 'importlib.resources'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "download_model.py", line 3, in <module>
    import requests
  File "/usr/local/lib/python3.5/dist-packages/requests/__init__.py", line 112, in <module>
    from . import utils
  File "/usr/local/lib/python3.5/dist-packages/requests/utils.py", line 24, in <module>
    from . import certs
  File "/usr/local/lib/python3.5/dist-packages/requests/certs.py", line 15, in <module>
    from certifi import where
  File "/usr/local/lib/python3.5/dist-packages/certifi/__init__.py", line 1, in <module>
    from .core import contents, where
  File "/usr/local/lib/python3.5/dist-packages/certifi/core.py", line 46, in <module>
    Resource = Union[str, "os.PathLike"]
  File "/usr/lib/python3.5/typing.py", line 552, in __getitem__
    dict(self.__dict__), parameters, _root=True)
  File "/usr/lib/python3.5/typing.py", line 512, in __new__
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 512, in <genexpr>
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 190, in __subclasscheck__
    self._eval_type(globalns, localns)
  File "/usr/lib/python3.5/typing.py", line 177, in _eval_type
    eval(self.__forward_code__, globalns, localns),
  File "<string>", line 1, in <module>
AttributeError: module 'os' has no attribute 'PathLike'
The command '/bin/sh -c python3 download_model.py 124M' returned a non-zero code: 1
@Vincent-vst
Copy link
Author

sooo, i pretty much spent my entire afternoon trying to make gpt2 work, and I finally manage to make it work.
This is how I did it :

# prerequesite : I have docker installed on my machine 
$ docker pull python:3.6
$ docker run -it python:3.6 bash
# at this point, you should be in a docker python3.6 environment 
$ git clone https://github.com/openai/gpt-2.git && cd gpt-2
$ pip install -r requirements.txt 
$ python3 download_model.py 124M 
$ pip install tensorflow==1.13.1 # not 1.12 since it no longer works
# and finally we can execute the script 
$ python3 src/interactive_conditional_samples.py --top_k 40

@thistleknot
Copy link

thistleknot commented Dec 11, 2022

nano DockerFile

FROM python:3.6
RUN git clone https://github.com/openai/gpt-2.git
RUN pip install -r gpt-2/requirements.txt
RUN pip install tensorflow==1.13.1
RUN cd gpt-2 && python3 download_model.py 124M
RUN cd gpt-2 && python3 download_model.py 355M
RUN cd gpt-2 && python3 download_model.py 774M
RUN cd gpt-2 && python3 download_model.py 1558M
RUN git clone https://github.com/nshepperd/gpt-2.git
#python3 src/interactive_conditional_samples.py --top_k 40

docker build --tag openai-gpt2 .

docker run -it -v /root/gpt-2:/opt openai-gpt2 bash -c "cd gpt-2 && python3 src/interactive_conditional_samples.py --top_k 3"

@Vectorrent
Copy link

The other examples are a bit overkill. To fix this, all I needed to do was upgrade the Tensorflow version in the default Dockerfile:

FROM tensorflow/tensorflow:1.13.2-gpu-py3

@Enzo90910
Copy link

If you are building the cpu Dockerfile, of course use
FROM tensorflow/tensorflow:1.13.2-py3
instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants