Client library to download and publish environments, agents on the huggingbutt.com hub
Project description
HuggingButt
Client library to download and publish reinforcement learning environments/agents on the huggingbutt.com hub
Installation
Because of the latest version of 'mlagents-envs', this project only goes up to Python 3.10.12. I will fix this in the future.
Create a new python environment using anaconda/miniconda.
conda create -n hb python==3.10.12
activate the new python environment.
conda activate hb
install huggingbutt from pypi
pip install huggingbutt
or from source code
git clone https://github.com/huggingbutt/huggingbutt.git
cd huggingbutt
python -m pip install .
If there is no error message printed during the installation, congratulations, you have successfully installed this package. Next, you need to apply an access token from the official website https://huggingbutt.com.
Register an account and login, just do as shown in the image below.
Click new token button generate a new token. This access token is mainly used to restrict the download times of each user, as the server cost is relatively high.
Congratulations, you now have an access token!
Just put the generated token in the task code and you're gooooood to go.
Here is a simple training code:
from huggingbutt import Env, set_access_token
from stable_baselines3.ppo import PPO
# your generated access token
ACCESS_TOKEN="YOUR_TOKEN"
if __name__ == '__main__':
set_access_token(ACCESS_TOKEN)
env = Env.get('huggingbutt/juggle', 'mac', startup_args=['--time_scale', '10'])
model = PPO("MlpPolicy", env, verbose=1)
model.learn(total_timesteps=2500)
model.save("ppo_juggle.model")
env.close()
Inference:
from huggingbutt import Agent, Env, set_access_token
# your generated access token
ACCESS_TOKEN="YOUR_TOKEN"
if __name__ == '__main__':
set_access_token(ACCESS_TOKEN)
env = Env.get('huggingbutt/juggle', 'mac', startup_args=['--time_scale', '1'])
agent = Agent.get(20, env)
obs = env.reset()
for i in range(1000):
act, _status_ = agent.predict(obs)
obs, reward, done, info = env.step(act)
if done:
obs = env.reset()
env.close()
todo
- Support more types learning environment, such as native game wrapped by python, pygame, class gym...
- Develop a framework, user can customize the observation, action and reward of the environment developed under this framework. We hope this makes it easier for everyone to iterate the environment's agent.
- There are still many ideas, I will add them later when I think about them...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for huggingbutt-0.0.3a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b31c6d3ff83095ab5755a048e099894e62f8ba907f7269f6bd1080bd78cc766 |
|
MD5 | 02e0138612a6f54064dcc75555b342d9 |
|
BLAKE2b-256 | 7ce5898876b72e7ccc365985f57c089cebb41241a1cba7744a8ed7255b5d1857 |