Skip to content

Commit

Permalink
float32
Browse files Browse the repository at this point in the history
  • Loading branch information
felimomo committed Feb 25, 2024
1 parent 7df8449 commit 63ec421
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rl4greencrab/green_crab_ipm.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def reset(self, *, seed=42, options=None):
self.reward = 0

# self.observations = np.zeros(shape=self.ntime)
self.observations = np.random.randint(0,100, size=self.ntime, dtype = np.float32)
self.observations = np.float32(np.random.randint(0,100, size=self.ntime))

return self.observations, {}

Expand Down
12 changes: 12 additions & 0 deletions src/rl4greencrab/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ def sb3_train(config_file):
except:
print("Could not deploy model to hugging face :(.")

def deploy_model(path, path_in_repo, repo, clean=False):
api = HfApi()
if path_in_repo is None:
path_in_repo = basename(path)
api.upload_file(
path_or_fileobj=path,
path_in_repo=path_in_repo,
repo_id=repo,
repo_type="model")
if clean:
pathlib.Path(path).unlink()

def sb3_train_v2(options = dict):
vec_env = make_vec_env(
options["env_id"], options["n_envs"], env_kwargs={"config": options["config"]}
Expand Down

0 comments on commit 63ec421

Please sign in to comment.