Paperspace Setup Instructions

I think the setup instructions could be a little bit clearer, unless I’m not reading them correctly. I believe you need to run git pull in the course-v4 directory in addition to the fastbook directory. Also, I think there is no fastbook/nbs directory (it appears that there is in the screenshot); all of the notebooks are just in the fastbook directory. These are not major issues but I was a bit confused by this so thought I would share in case it helped anybody else.

Edit: The screenshot is actually of the course-v4 directory but it is shown after it says to click on fastbook. That’s why I was confused.

1 Like

I’ve also noticed that the paperspace default environment for fastai seems not to have the relevant changes where fastai2 becomes fastai. I’m not quite sure what I need to change for that to be the case.

!pip uninstall fastai2
!pip install fastai —upgrade

Should do the trick @strickvl

I should have mentioned I did the extra git pull in the course-v4 directory because I noticed that it was still referring to fastai2 in the notebooks. git pull in course-v4 updates them properly to the latest versions.

Yes, @jonadelson. I submitted an issue here so that the documentation gets updated with that specific fix. It shouldn’t be necessary to do what @muellerzr suggests since fastai2 won’t have been mentioned in the first place.

1 Like

I am not able to even setup a first notebook before getting a message that I have reached my daily limit. Is it only me or other are facing same issue? I am trying to use free GPU core.


I am facing the attached error when using paperspace gradient I try to run the second cell of the very first notebook of course-v4.

Hi, Tom from Paperspace here.

Strange to see this error as I’ve been unable to reproduce it. Are you running your notebook on a GPU capable instance such Free-GPU or Free-P5000? Fastai courses will not work on a CPU only instance. Lastly, if you are still experiencing issues please try with the latest container as we’ve pushed several fixes on Friday.

Got this error in course-v4/nbs/01_intro.ipynb on Paperspace.

from fastai.text.all import *

dls = TextDataLoaders.from_folder(untar_data(URLs.IMDB), valid='test')
learn = text_classifier_learner(dls, AWD_LSTM, drop_mult=0.5, metrics=accuracy)
learn.fine_tune(4, 1e-2)

Don’t understand why, I checked, fastai.__version__ is 2.0.0 . Other cells were running fine. I followed the exact instructions from website.

---------------------------------------------------------------------------
EmptyHeaderError                          Traceback (most recent call last)
/opt/conda/envs/fastai/lib/python3.8/tarfile.py in next(self)
   2312             try:
-> 2313                 tarinfo = self.tarinfo.fromtarfile(self)
   2314             except EOFHeaderError as e:

/opt/conda/envs/fastai/lib/python3.8/tarfile.py in fromtarfile(cls, tarfile)
   1102         buf = tarfile.fileobj.read(BLOCKSIZE)
-> 1103         obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors)
   1104         obj.offset = tarfile.fileobj.tell() - BLOCKSIZE

/opt/conda/envs/fastai/lib/python3.8/tarfile.py in frombuf(cls, buf, encoding, errors)
   1038         if len(buf) == 0:
-> 1039             raise EmptyHeaderError("empty header")
   1040         if len(buf) != BLOCKSIZE:

EmptyHeaderError: empty header

During handling of the above exception, another exception occurred:

ReadError                                 Traceback (most recent call last)
<ipython-input-7-5ab79cd5e866> in <module>
      2 
      3 dls = TextDataLoaders.from_folder(untar_data(URLs.IMDB), valid='test')
----> 4 learn = text_classifier_learner(dls, AWD_LSTM, drop_mult=0.5, metrics=accuracy)
      5 learn.fine_tune(4, 1e-2)

/opt/conda/envs/fastai/lib/python3.8/site-packages/fastcore/utils.py in _f(*args, **kwargs)
    448         log_dict = {**func_args.arguments, **{f'{k} (not in signature)':v for k,v in xtra_kwargs.items()}}
    449         log = {f'{f.__qualname__}.{k}':v for k,v in log_dict.items() if k not in but}
--> 450         inst = f(*args, **kwargs) if to_return else args[0]
    451         init_args = getattr(inst, 'init_args', {})
    452         init_args.update(log)

/opt/conda/envs/fastai/lib/python3.8/site-packages/fastai/text/learner.py in text_classifier_learner(dls, arch, seq_len, config, backwards, pretrained, drop_mult, n_out, lin_ftrs, ps, max_len, y_range, **kwargs)
    230             warn("There are no pretrained weights for that architecture yet!")
    231             return learn
--> 232         model_path = untar_data(meta[url], c_key='model')
    233         fnames = [list(model_path.glob(f'*.{ext}'))[0] for ext in ['pth', 'pkl']]
    234         learn = learn.load_pretrained(*fnames, model=learn.model[0])

/opt/conda/envs/fastai/lib/python3.8/site-packages/fastai/data/external.py in untar_data(url, fname, dest, c_key, force_download, extract_func)
    257         if _get_check(url) and _check_file(fname) != _get_check(url):
    258             print(f"File downloaded is broken. Remove {fname} and try again.")
--> 259         extract_func(fname, dest.parent)
    260         rename_extracted(dest)
    261     return dest

/opt/conda/envs/fastai/lib/python3.8/site-packages/fastai/data/external.py in file_extract(fname, dest)
    217     if dest is None: dest = Path(fname).parent
    218     fname = str(fname)
--> 219     if   fname.endswith('gz'):  tarfile.open(fname, 'r:gz').extractall(dest)
    220     elif fname.endswith('zip'): zipfile.ZipFile(fname     ).extractall(dest)
    221     else: raise Exception(f'Unrecognized archive: {fname}')

/opt/conda/envs/fastai/lib/python3.8/tarfile.py in open(cls, name, mode, fileobj, bufsize, **kwargs)
   1617             else:
   1618                 raise CompressionError("unknown compression type %r" % comptype)
-> 1619             return func(name, filemode, fileobj, **kwargs)
   1620 
   1621         elif "|" in mode:

/opt/conda/envs/fastai/lib/python3.8/tarfile.py in gzopen(cls, name, mode, fileobj, compresslevel, **kwargs)
   1670 
   1671         try:
-> 1672             t = cls.taropen(name, mode, fileobj, **kwargs)
   1673         except OSError:
   1674             fileobj.close()

/opt/conda/envs/fastai/lib/python3.8/tarfile.py in taropen(cls, name, mode, fileobj, **kwargs)
   1647         if mode not in ("r", "a", "w", "x"):
   1648             raise ValueError("mode must be 'r', 'a', 'w' or 'x'")
-> 1649         return cls(name, mode, fileobj, **kwargs)
   1650 
   1651     @classmethod

/opt/conda/envs/fastai/lib/python3.8/tarfile.py in __init__(self, name, mode, fileobj, format, tarinfo, dereference, ignore_zeros, encoding, errors, pax_headers, debug, errorlevel, copybufsize)
   1510             if self.mode == "r":
   1511                 self.firstmember = None
-> 1512                 self.firstmember = self.next()
   1513 
   1514             if self.mode == "a":

/opt/conda/envs/fastai/lib/python3.8/tarfile.py in next(self)
   2326             except EmptyHeaderError:
   2327                 if self.offset == 0:
-> 2328                     raise ReadError("empty file")
   2329             except TruncatedHeaderError as e:
   2330                 if self.offset == 0:

ReadError: empty file

Thank you so much Tom for taking out the time to solve my issue.
Yes, I now see that my instance is a CPU instead of a GPU. However, I am unable to start a GPU enabled instance like Free-GPU and Free-P5000 due to the error:


Thanks In Advance

EDIT: I tried making a new GPU enabled instance again. And it was a success!! :smiley:

1 Like

I get the same error as well. :frowning:

This worked:

pip install fastai fastcore --upgrade

But this failed:

cd fastbook

No such directory. What am I missing? Or is the instruction page out-of-date?

2 Likes

I have faced the same issues ( cd: fastbook: No such file or directory). I tried your recommendation of uninstall fastai2 and then installing the upgrade but still end up with the same problem. Also I am unable to see the fastbook and course-v4 folders on my jupyter notebook. Any fix that I am missing, any help out there?

1 Like

I have faced and still facing the same issues ( cd: fastbook: No such file or directory). I tried your recommendation of uninstall fastai2 and then installing the upgrade but still end up with the same problem. Also I am unable to see the fastbook and course-v4 folders on my jupyter notebook. Any fix that I am missing, any help out there?

For everyone having the issue with cd fastbook, what I understood from the GitHub page, and what worked for me, is to open the “clean” folder instead. The cleaned notebooks were there, and no additional update/git pull was needed.

For the course organizers: updating this on the Gradient/Paperspace setup instructions would be helpful.

3 Likes

Hi Ian! could you screen shot your actions please? would be really helpful! I think I am opening a new folder in a wrong place (root directory of jupyter - next to datasets and storage).

Everyone is getting this error because there is no such directory as the library is not connected to jupyter, so the error is completely normal in such instance. I am sorting though github but can only find the same information on paperspace.

Looks like several of you have been having issues when entering cd fastbook into the terminal.

I also got an error saying there was no such folder. However, creating a test notebook and then clicking on “new” as in step 4 of the instructions revealed I did have all the notebooks from the book.

Try that and see if it helps!

1 Like

I think that totally worked! I created a new notebook (and deleted the initial one) and could not cd fastbook (as theres still no such directory), but the files are there. Did git pull and it says all files are up to date. Thank you!:slight_smile:

1 Like

Hi Ruta,
I read above you already solved the issue, but here’s the screenshot of where you can find the clean notebooks (without any real actions needed):

1 Like