How do I import zip files from HF to colab

I am trying to import my data to DFL_Colab. I extracted and cleaned up the data when I attempted to use DFL locally then I uploaded the data to HF. I dont know how any of this works so I tried copying and pasting a number of things.
Notebook Link
Cell code:

`#@title Import from URL{ form-width: “30%”, display->mode: “form” }
URL = >“>” #@param {type:“string”}
Mode = “unzip to content” #@param [“unzip to content”, “unzip to content/workspace”, “unzip to content/workspace/data_src”, “unzip to content/workspace/data_src/aligned”, “unzip to content/workspace/data_dst”, “unzip to content/workspace/data_dst/aligned”, “unzip to content/workspace/model”, “download to content/workspace”]

import urllib.request
from pathlib import Path

def unzip(zip_path, dest_path):

unzip_cmd = " unzip -q " + zip_path + " -d "+dest_path
rm_cmd = "rm "+dest_path +

if Mode == “unzip to content”:
dest_path = “/content/”
elif Mode == “unzip to content/workspace”:
dest_path = “/content/workspace/”
elif Mode == “unzip to content/workspace/data_src”:
dest_path = “/content/workspace/data_src/”
elif Mode == “unzip to content/workspace/data_src/aligned”:
dest_path = “/content/workspace/data_src/aligned/”
elif Mode == “unzip to content/workspace/data_dst”:
dest_path = “/content/workspace/data_dst/”
elif Mode == “unzip to content/workspace/data_dst/aligned”:
dest_path = “/content/workspace/data_dst/aligned/”
elif Mode == “unzip to content/workspace/model”:
dest_path = “/content/workspace/model/”
elif Mode == “download to content/workspace”:
dest_path = “/content/workspace/”

if not Path(“/content/workspace”).exists():
cmd = “mkdir /content/workspace; mkdir /content/workspace/data_src; mkdir /content/workspace/data_src/aligned; mkdir /content/workspace/data_dst; mkdir /content/workspace/data_dst/aligned; mkdir /content/workspace/model”

url_path = Path(URL)
urllib.request.urlretrieve ( URL, dest_path + )

if (url_path.suffix == “.zip”) and (Mode!=“download to content/workspace”):
unzip(dest_path +, dest_path)


‘I get some variation of the errors below. I tried usermane:password@url, making it public, installing transformers. If this doesnt work on colab at all is there another notebook I could use?’


'HTTPError Traceback (most recent call last)
in <cell line: 40>()
39 url_path = Path(URL)
—> 40 urllib.request.urlretrieve ( URL, dest_path + )
42 if (url_path.suffix == “.zip”) and (Mode!=“download to content/workspace”):

6 frames
/usr/lib/python3.10/urllib/ in http_error_default(self, req, fp, code, msg, hdrs)
641 class HTTPDefaultErrorHandler(BaseHandler):
642 def http_error_default(self, req, fp, code, msg, hdrs):
→ 643 raise HTTPError(req.full_url, code, msg, hdrs, fp)
645 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 401: Unauthorized’

if anyone is googling this here is what worked for me

!pip install huggingface_hub
from huggingface_hub import hf_hub_download
from huggingface_hub import login


#import the file or repository
!git clone

#this converts the zip to a usable format

!zip -FF path/to/zipfile --output path/to/output/zip

#unzip the file
!unzip path/to/your/zip