Skip to content
Snippets Groups Projects
Unverified Commit adb4c9b4 authored by Christophe Bornet's avatar Christophe Bornet Committed by GitHub
Browse files

Fix download_llama_dataset and download_llama_pack (#12273)

parent f6ed4a67
Branches master
No related tags found
No related merge requests found
...@@ -90,7 +90,9 @@ def initialize_directory( ...@@ -90,7 +90,9 @@ def initialize_directory(
def get_source_files_list(source_tree_url: str, path: str) -> List[str]: def get_source_files_list(source_tree_url: str, path: str) -> List[str]:
"""Get the list of source files to download.""" """Get the list of source files to download."""
resp = requests.get(source_tree_url + path + "?recursive=1") resp = requests.get(
source_tree_url + path + "?recursive=1", headers={"Accept": "application/json"}
)
payload = resp.json()["payload"] payload = resp.json()["payload"]
return [item["name"] for item in payload["tree"]["items"]] return [item["name"] for item in payload["tree"]["items"]]
...@@ -105,7 +107,7 @@ def recursive_tree_traverse( ...@@ -105,7 +107,7 @@ def recursive_tree_traverse(
url = tree_urls[0] url = tree_urls[0]
try: try:
res = requests.get(url) res = requests.get(url, headers={"Accept": "application/json"})
tree_elements = res.json()["payload"]["tree"]["items"] tree_elements = res.json()["payload"]["tree"]["items"]
except Exception: except Exception:
raise ValueError("Failed to traverse github tree source.") raise ValueError("Failed to traverse github tree source.")
......
...@@ -47,7 +47,9 @@ def _resolve_dataset_file_name(class_name: str) -> str: ...@@ -47,7 +47,9 @@ def _resolve_dataset_file_name(class_name: str) -> str:
def _get_source_files_list(source_tree_url: str, path: str) -> List[str]: def _get_source_files_list(source_tree_url: str, path: str) -> List[str]:
"""Get the list of source files to download.""" """Get the list of source files to download."""
resp = requests.get(source_tree_url + path + "?recursive=1") resp = requests.get(
source_tree_url + path + "?recursive=1", headers={"Accept": "application/json"}
)
payload = resp.json()["payload"] payload = resp.json()["payload"]
return [item["name"] for item in payload["tree"]["items"]] return [item["name"] for item in payload["tree"]["items"]]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment