I am done

This commit is contained in:
2024-10-30 22:14:35 +01:00
parent 720dc28c09
commit 40e2a747cf
36901 changed files with 5011519 additions and 0 deletions

View File

@ -0,0 +1,36 @@
# we download examples from github and we save them in the examples folder
import os
import shutil
from zipfile import ZipFile
import wget
BRANCHES = {"4": "main", "3": "godot3.5"}
BASE_URL = "https://github.com/edbeeching/godot_rl_agents_examples"
def download_examples():
# select branch
print("Select Godot version:")
for key in BRANCHES.keys():
print(f"{key} : {BRANCHES[key]}")
branch = input("Enter your choice: ")
BRANCH = BRANCHES[branch]
os.makedirs("examples", exist_ok=True)
URL = f"{BASE_URL}/archive/refs/heads/{BRANCH}.zip"
print(f"downloading examples from {URL}")
wget.download(URL, out="")
print()
print("unzipping")
with ZipFile(f"{BRANCH}.zip", "r") as zipObj:
# Extract all the contents of zip file in different directory
zipObj.extractall("examples/")
print("cleaning up")
os.remove(f"{BRANCH}.zip")
print("moving files")
for file in os.listdir(f"examples/godot_rl_agents_examples-{BRANCH}"):
shutil.move(f"examples/godot_rl_agents_examples-{BRANCH}/{file}", "examples")
os.rmdir(f"examples/godot_rl_agents_examples-{BRANCH}")

View File

@ -0,0 +1,57 @@
import os
from sys import platform
from zipfile import ZipFile
import wget
BASE_URL = "https://downloads.tuxfamily.org/godotengine/"
VERSIONS = {"3": "3.5.1", "4": "4.0"}
MOST_RECENT_VERSION = "rc5"
def get_version():
while True:
version = input("Which Godot version do you want to download (3 or 4)? ")
if version in VERSIONS:
return version
print("Invalid version. Please enter 3 or 4.")
def download_editor():
version = get_version()
VERSION = VERSIONS[version]
NEW_BASE_URL = f"{BASE_URL}{VERSION}/{version}/"
NAME = "stable"
if VERSION == "4.0":
NEW_BASE_URL = f"{BASE_URL}{VERSION}/{MOST_RECENT_VERSION}/"
NAME = MOST_RECENT_VERSION
LINUX_FILENAME = f"Godot_v{VERSION}-{NAME}_linux.x86_64.zip"
if VERSION == "4.0":
MAC_FILENAME = f"Godot_v{VERSION}-{NAME}_macos.universal.zip"
else:
MAC_FILENAME = f"Godot_v{VERSION}-{NAME}_osx.universal.64.zip"
WINDOWS_FILENAME = f"Godot_v{VERSION}-{NAME}_win64.exe.zip"
os.makedirs("editor", exist_ok=True)
FILENAME = ""
if platform == "linux" or platform == "linux2":
FILENAME = LINUX_FILENAME
elif platform == "darwin":
FILENAME = MAC_FILENAME
elif platform == "win32" or platform == "win64":
FILENAME = WINDOWS_FILENAME
else:
raise NotImplementedError
URL = f"{NEW_BASE_URL}{FILENAME}"
print(f"downloading editor {FILENAME} for platform: {platform}")
wget.download(URL, out="")
print()
print("unzipping")
with ZipFile(FILENAME, "r") as zipObj:
# Extract all the contents of zip file in different directory
zipObj.extractall("editor/")
print("cleaning up")
os.remove(FILENAME)

View File

@ -0,0 +1,37 @@
import argparse
import os
from huggingface_hub import Repository
def load_from_hf(dir_path: str, repo_id: str):
temp = repo_id.split("/")
repo_name = temp[1]
local_dir = os.path.join(dir_path, repo_name)
Repository(local_dir, repo_id, repo_type="dataset")
print(f"The repository {repo_id} has been cloned to {local_dir}")
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"-r",
"--hf_repository",
help="Repo id of the dataset / environment repo from the Hugging Face Hub in the form user_name/repo_name",
type=str,
)
parser.add_argument(
"-d",
"--example_dir",
help="Local destination of the repository. Will save repo to examples/repo_name",
type=str,
default="./examples",
)
args = parser.parse_args()
load_from_hf(args.example_dir, args.hf_repository)
if __name__ == "__main__":
main()