Package: siste-test
HyperFetchHyperFetch is a tool consisting of:Websitefor fetching hyperparameters that are tuned by othersPip-module for tuning hyperparametersThe intention of HyperFetch is to:Make recreation of existing projects easier within the
reinforcement learning research community.Allow beginners to train and implement their own reinforcement
learning models easier due to abstracting away the advanced tuning-step.The tool is expected to aid in decreasing CO2-emissions related to tuning hyperparameters when training RL models.This is expected to be done by posting tuned algorithm x environment combinations to the websitesuch that:Developers/Students can access hyperparameters that have been optimially tuned before instead of having to tune them themselves.Researchers can filter by project on the website and access hyperparameters they wish to recreate/replicate for their own research.The persistance endpoints opens up to the user through this package.
To access/fetch hyperparameters optimized by other RL-practicioners,
have a look at the HyperFetch website.ContentLinks1.0Using the pip module1.1Examples2.0Using the Website2.1Installation backend2.2Setup backend2.3Setup frontend2.4Installation frontendLinksRepository:HyperFetch GithubDocumentation:HyperFetch WebsiteUsing the pip moduleTo use the pip model please do the following:Create a virtual environment in your favorite IDE. The virtual environment must be of the type virtualenv.Install virtualenv if you haven'tpip install virtualenvCreate a virtual environmentvirtualenv [some_name]Activate virtualenv this way if using windows:# In cmd.exe
   venv\Scripts\activate.bat
   # In PowerShell
   venv\Scripts\Activate.ps1Activate virtualenv this way if using Linux/MacOS:$ source myvenv/bin/activateInstall the pip-module!Example 1: tuning + posting using HyperFetchHere is a quick example of how to tune and run PPO in the LunarLander-v2 environment inside your new or existing project:Just a reminder:The pip package must be installed before this can be done.
To install the pip-package, the steps to get thefront-orbackendstarted/running do not need to be done.For details, seeusing the pip module.1. Create configuartion  YAML file (minimal example)# Required (example values)alg:ppoenv:LunarLander-v2project_name:some_projectgit_link:github.com/user/some_project# Some other useful parameterssampler:tpetuner:mediann_trials:20log_folder:logs2. Tune using python file or command linefromhyperfetchimporttuning# Path to your YAML config fileconfig_path="../some_folder/config_name.yml"# Writes each trial's best hyperparameters to log foldertuning.tune(config_path)Command line:If in the same directory as the config file and the config file is called "config.yml"tune_cli config.ymlEnjoy your hyperparameters!Example 2: Posting hyperparameters that are not tuned by HyperfetchJust a reminder:The pip package must be installed before this can be done.
To install the pip-package, the steps to get thefront-orbackendstarted/running do not need to be done.For details, seeusing the pip module.1. Create configuartion  YAML file# Required (example values)alg:dqnenv:LunarLander-v2project_name:some_projectgit_link:github.com/user/some_projecthyperparameters:# These depend on the choice of algorithmbatch_size:256buffer_size:50000exploration_final_eps:0.10717928118310233exploration_fraction:0.3318973226098944gamma:0.9learning_rate:0.0002126832542803243learning_starts:10000net_arch:mediumsubsample_steps:4target_update_interval:1000train_freq:8# Not required (but appreciated)CO2_emissions:0.78#kgsenergy_consumed:3.27#kWhcpu_model:12th Gen Intel(R) Core(TM) i5-12500Hgpu_model:NVIDIA GeForce RTX 3070total_time:0:04:16.842800# H:M:S:MS2. Save/post using python file or command linePython file:fromhyperfetchimporttuning# Path to your YAML config fileconfig_path="../some_folder/config_name.yml"# Writes each trial's best hyperparameters to log foldertuning.save(config_path)Command line:If in the same directory as the config file and the config file is called "config.yml"save_cli config.ymlGetting the website up and runningInstallation backendMake sure you havePip version 23.0.1 or higherPython 3.10virtualenv (not venv)
Clone this repository by either:Open git bashChange the current working directory to the location where you want the cloned directory.Paste this snip:git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORYInstall virtualenv if you haven'tpip install virtualenvCreate a virtual environmentvirtualenv [some_name]Activate virtualenv this way if using windows:# In cmd.exe
venv\Scripts\activate.bat
# In PowerShell
venv\Scripts\Activate.ps1Activate virtualenv this way if using Linux/MacOS:$ source myvenv/bin/activatePress Enter to create your local clone.Cloning into 'hyperFetch'...
 remote: Enumerating objects: 466, done.
 remote: Counting objects: 100% (466/466), done.
 remote: Compressing objects: 100% (238/238), done.
 remote: Total 466 (delta 221), reused 438 (delta 200), pack-reused 0
 Receiving objects: 100% (466/466), 4.17 MiB | 10.29 MiB/s, done.
 Resolving deltas: 100% (221/221), done.You may now change directory by writing into the terminal:cd hyperfetchThen, install the dependencies into your virtual environmentpip install -r requirements.txtStart up backendAfter cloning and installing, you can finally start up the server!uvicorn main:app --reloadInstallation frontendThe frontend-branch is inside of the same project. However,
because the frontend-branch (frontend) and backend-branch (master)
must run at the same time to serve the website,
the project must be cloned twice into two different local respositories.Follow stages 3-6 ininstallation backendThis includes:Move into another working directoryClone the projectCreate a new virtualenvActivate the virtualenvThe frontend-branch does not exist locally and must be fetched remotely.
In the terminal, type:git switch frontendEnter the correct foldercd srcInstall dependencies. This will creat a node_modules folder in your local repository.npm installStart up frontendTo serve the website (dev mode), run:npm run devClick the link that appears in the terminal, or access your browser of choice and type in:http://localhost:5173/Good luck!