qgallouedec HF Staff commited on
Commit
9bbc59c
·
1 Parent(s): 38084eb

Upload folder using huggingface_hub

Browse files
.summary/0/events.out.tfevents.1688782585.qgallouedec-MS-7C84 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d06d4bd297ebc0f7947212ef7c690f09ac114c72b1cb8030d83b40a64b6dd339
3
+ size 728972
README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: sample-factory
3
+ tags:
4
+ - deep-reinforcement-learning
5
+ - reinforcement-learning
6
+ - sample-factory
7
+ model-index:
8
+ - name: APPO
9
+ results:
10
+ - task:
11
+ type: reinforcement-learning
12
+ name: reinforcement-learning
13
+ dataset:
14
+ name: handle-pull-side-v2
15
+ type: handle-pull-side-v2
16
+ metrics:
17
+ - type: mean_reward
18
+ value: 107.27 +/- 101.16
19
+ name: mean_reward
20
+ verified: false
21
+ ---
22
+
23
+ A(n) **APPO** model trained on the **handle-pull-side-v2** environment.
24
+
25
+ This model was trained using Sample-Factory 2.0: https://github.com/alex-petrenko/sample-factory.
26
+ Documentation for how to use Sample-Factory can be found at https://www.samplefactory.dev/
27
+
28
+
29
+ ## Downloading the model
30
+
31
+ After installing Sample-Factory, download the model with:
32
+ ```
33
+ python -m sample_factory.huggingface.load_from_hub -r qgallouedec/handle-pull-side-v2
34
+ ```
35
+
36
+
37
+ ## Using the model
38
+
39
+ To run the model after download, use the `enjoy` script corresponding to this environment:
40
+ ```
41
+ python -m enjoy --algo=APPO --env=handle-pull-side-v2 --train_dir=./train_dir --experiment=handle-pull-side-v2
42
+ ```
43
+
44
+
45
+ You can also upload models to the Hugging Face Hub using the same script with the `--push_to_hub` flag.
46
+ See https://www.samplefactory.dev/10-huggingface/huggingface/ for more details
47
+
48
+ ## Training with this model
49
+
50
+ To continue training with this model, use the `train` script corresponding to this environment:
51
+ ```
52
+ python -m train --algo=APPO --env=handle-pull-side-v2 --train_dir=./train_dir --experiment=handle-pull-side-v2 --restart_behavior=resume --train_for_env_steps=10000000000
53
+ ```
54
+
55
+ Note, you may have to adjust `--train_for_env_steps` to a suitably high number as the experiment will resume at the number of steps it concluded at.
56
+
checkpoint_p0/best_000002720_1392640_reward_120.921.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e23f6855ec735d3b3ad8108b84e015d4de173cea503d142315218cdbe12389af
3
+ size 98239
checkpoint_p0/checkpoint_000019408_9936896.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f410a59f07499aa4d463cc94a917216ae9f6a939084a9bb9a3f2f3f7a0ca473
3
+ size 98567
checkpoint_p0/checkpoint_000019544_10006528.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b9f062c7ae1c78d7c556c2805247f2fa65cd37b47d13ba19b705fe7cea90fa0
3
+ size 98567
config.json ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "help": false,
3
+ "algo": "APPO",
4
+ "env": "handle-pull-side-v2",
5
+ "experiment": "handle-pull-side-v2",
6
+ "train_dir": "/home/qgallouedec/data/gia/data/envs/metaworld/train_dir",
7
+ "restart_behavior": "restart",
8
+ "device": "cpu",
9
+ "seed": null,
10
+ "num_policies": 1,
11
+ "async_rl": false,
12
+ "serial_mode": false,
13
+ "batched_sampling": false,
14
+ "num_batches_to_accumulate": 2,
15
+ "worker_num_splits": 2,
16
+ "policy_workers_per_policy": 1,
17
+ "max_policy_lag": 1000,
18
+ "num_workers": 8,
19
+ "num_envs_per_worker": 8,
20
+ "batch_size": 1024,
21
+ "num_batches_per_epoch": 4,
22
+ "num_epochs": 2,
23
+ "rollout": 64,
24
+ "recurrence": 1,
25
+ "shuffle_minibatches": false,
26
+ "gamma": 0.99,
27
+ "reward_scale": 0.1,
28
+ "reward_clip": 1000.0,
29
+ "value_bootstrap": true,
30
+ "normalize_returns": true,
31
+ "exploration_loss_coeff": 0.0,
32
+ "value_loss_coeff": 1.3,
33
+ "kl_loss_coeff": 0.1,
34
+ "exploration_loss": "entropy",
35
+ "gae_lambda": 0.95,
36
+ "ppo_clip_ratio": 0.2,
37
+ "ppo_clip_value": 1.0,
38
+ "with_vtrace": false,
39
+ "vtrace_rho": 1.0,
40
+ "vtrace_c": 1.0,
41
+ "optimizer": "adam",
42
+ "adam_eps": 1e-06,
43
+ "adam_beta1": 0.9,
44
+ "adam_beta2": 0.999,
45
+ "max_grad_norm": 3.5,
46
+ "learning_rate": 0.00295,
47
+ "lr_schedule": "linear_decay",
48
+ "lr_schedule_kl_threshold": 0.008,
49
+ "lr_adaptive_min": 1e-06,
50
+ "lr_adaptive_max": 0.01,
51
+ "obs_subtract_mean": 0.0,
52
+ "obs_scale": 1.0,
53
+ "normalize_input": true,
54
+ "normalize_input_keys": null,
55
+ "decorrelate_experience_max_seconds": 0,
56
+ "decorrelate_envs_on_one_worker": true,
57
+ "actor_worker_gpus": [],
58
+ "set_workers_cpu_affinity": true,
59
+ "force_envs_single_thread": false,
60
+ "default_niceness": 0,
61
+ "log_to_file": true,
62
+ "experiment_summaries_interval": 3,
63
+ "flush_summaries_interval": 30,
64
+ "stats_avg": 100,
65
+ "summaries_use_frameskip": true,
66
+ "heartbeat_interval": 20,
67
+ "heartbeat_reporting_interval": 180,
68
+ "train_for_env_steps": 10000000,
69
+ "train_for_seconds": 10000000000,
70
+ "save_every_sec": 15,
71
+ "keep_checkpoints": 2,
72
+ "load_checkpoint_kind": "latest",
73
+ "save_milestones_sec": -1,
74
+ "save_best_every_sec": 5,
75
+ "save_best_metric": "reward",
76
+ "save_best_after": 100000,
77
+ "benchmark": false,
78
+ "encoder_mlp_layers": [
79
+ 64,
80
+ 64
81
+ ],
82
+ "encoder_conv_architecture": "convnet_simple",
83
+ "encoder_conv_mlp_layers": [
84
+ 512
85
+ ],
86
+ "use_rnn": false,
87
+ "rnn_size": 512,
88
+ "rnn_type": "gru",
89
+ "rnn_num_layers": 1,
90
+ "decoder_mlp_layers": [],
91
+ "nonlinearity": "tanh",
92
+ "policy_initialization": "torch_default",
93
+ "policy_init_gain": 1.0,
94
+ "actor_critic_share_weights": true,
95
+ "adaptive_stddev": false,
96
+ "continuous_tanh_scale": 0.0,
97
+ "initial_stddev": 1.0,
98
+ "use_env_info_cache": false,
99
+ "env_gpu_actions": false,
100
+ "env_gpu_observations": true,
101
+ "env_frameskip": 1,
102
+ "env_framestack": 1,
103
+ "pixel_format": "CHW",
104
+ "use_record_episode_statistics": false,
105
+ "with_wandb": true,
106
+ "wandb_user": "qgallouedec",
107
+ "wandb_project": "sample_facotry_metaworld",
108
+ "wandb_group": null,
109
+ "wandb_job_type": "SF",
110
+ "wandb_tags": [],
111
+ "with_pbt": false,
112
+ "pbt_mix_policies_in_one_env": true,
113
+ "pbt_period_env_steps": 5000000,
114
+ "pbt_start_mutation": 20000000,
115
+ "pbt_replace_fraction": 0.3,
116
+ "pbt_mutation_rate": 0.15,
117
+ "pbt_replace_reward_gap": 0.1,
118
+ "pbt_replace_reward_gap_absolute": 1e-06,
119
+ "pbt_optimize_gamma": false,
120
+ "pbt_target_objective": "true_objective",
121
+ "pbt_perturb_min": 1.1,
122
+ "pbt_perturb_max": 1.5,
123
+ "command_line": "--env handle-pull-side-v2 --experiment handle-pull-side-v2 --with_wandb True --wandb_user qgallouedec --wandb_project sample_facotry_metaworld",
124
+ "cli_args": {
125
+ "env": "handle-pull-side-v2",
126
+ "experiment": "handle-pull-side-v2",
127
+ "with_wandb": true,
128
+ "wandb_user": "qgallouedec",
129
+ "wandb_project": "sample_facotry_metaworld"
130
+ },
131
+ "git_hash": "66db1b7a27030aa65fcfa2d6e3503089a7cff207",
132
+ "git_repo_name": "https://github.com/huggingface/gia",
133
+ "wandb_unique_id": "handle-pull-side-v2_20230708_041623_261681"
134
+ }
git.diff ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/gia/eval/callback.py b/gia/eval/callback.py
2
+ index 5c3a080..4b6198f 100644
3
+ --- a/gia/eval/callback.py
4
+ +++ b/gia/eval/callback.py
5
+ @@ -2,10 +2,10 @@ import glob
6
+ import json
7
+ import subprocess
8
+
9
+ -import wandb
10
+ from accelerate import Accelerator
11
+ from transformers import TrainerCallback, TrainerControl, TrainerState, TrainingArguments
12
+
13
+ +import wandb
14
+ from gia.config import Arguments
15
+ from gia.eval.utils import is_slurm_available
16
+
17
+ diff --git a/gia/eval/evaluator.py b/gia/eval/evaluator.py
18
+ index 91b645c..3e2cae7 100644
19
+ --- a/gia/eval/evaluator.py
20
+ +++ b/gia/eval/evaluator.py
21
+ @@ -1,3 +1,5 @@
22
+ +from typing import Optional
23
+ +
24
+ import torch
25
+
26
+ from gia.config.arguments import Arguments
27
+ @@ -5,11 +7,12 @@ from gia.model import GiaModel
28
+
29
+
30
+ class Evaluator:
31
+ - def __init__(self, args: Arguments, task: str) -> None:
32
+ + def __init__(self, args: Arguments, task: str, mean_random: Optional[float] = None) -> None:
33
+ self.args = args
34
+ self.task = task
35
+ + self.mean_random = mean_random
36
+
37
+ - @torch.no_grad()
38
+ + @torch.inference_mode()
39
+ def evaluate(self, model: GiaModel) -> float:
40
+ return self._evaluate(model)
41
+
42
+ diff --git a/gia/eval/rl/envs/core.py b/gia/eval/rl/envs/core.py
43
+ index ec5e5b2..eeaf7cb 100644
44
+ --- a/gia/eval/rl/envs/core.py
45
+ +++ b/gia/eval/rl/envs/core.py
46
+ @@ -177,7 +177,6 @@ def make(task_name: str, num_envs: int = 1):
47
+
48
+ elif task_name.startswith("metaworld"):
49
+ import gymnasium as gym
50
+ - import metaworld
51
+
52
+ env_id = TASK_TO_ENV_MAPPING[task_name]
53
+ env = gym.vector.SyncVectorEnv([lambda: gym.make(env_id)] * num_envs)
54
+ diff --git a/gia/eval/rl/gia_agent.py b/gia/eval/rl/gia_agent.py
55
+ index f0d0b9b..39dc0d2 100644
56
+ --- a/gia/eval/rl/gia_agent.py
57
+ +++ b/gia/eval/rl/gia_agent.py
58
+ @@ -54,7 +54,7 @@ class GiaAgent:
59
+ self.action_space = action_space
60
+ self.deterministic = deterministic
61
+ self.device = next(model.parameters()).device
62
+ - self._max_length = self.model.config.max_position_embeddings - 10
63
+ + self._max_length = self.model.config.max_position_embeddings - 100 # TODO: fix this
64
+
65
+ if isinstance(observation_space, spaces.Box):
66
+ self._observation_key = "continuous_observations"
67
+ @@ -75,6 +75,11 @@ class GiaAgent:
68
+ ) -> Tuple[Tuple[Tensor, Tensor], ...]:
69
+ return tuple((k[:, :, -self._max_length :], v[:, :, -self._max_length :]) for (k, v) in past_key_values)
70
+
71
+ + def set_model(self, model: GiaModel) -> None:
72
+ + self.model = model
73
+ + self.device = next(model.parameters()).device
74
+ + self._max_length = self.model.config.max_position_embeddings
75
+ +
76
+ def reset(self, num_envs: int = 1) -> None:
77
+ if self.prompter is not None:
78
+ prompts = self.prompter.generate_prompts(num_envs)
79
+ diff --git a/gia/eval/rl/gym_evaluator.py b/gia/eval/rl/gym_evaluator.py
80
+ index f8531ee..754c05d 100644
81
+ --- a/gia/eval/rl/gym_evaluator.py
82
+ +++ b/gia/eval/rl/gym_evaluator.py
83
+ @@ -1,7 +1,7 @@
84
+ import gym
85
+ from gym.vector.vector_env import VectorEnv
86
+
87
+ -from gia.eval.mappings import TASK_TO_ENV_MAPPING
88
+ +# from gia.eval.rl.envs.mappings import TASK_TO_ENV_MAPPING
89
+ from gia.eval.rl.rl_evaluator import RLEvaluator
90
+
91
+
92
+ diff --git a/gia/eval/rl/rl_evaluator.py b/gia/eval/rl/rl_evaluator.py
93
+ index c5cc423..91189f3 100644
94
+ --- a/gia/eval/rl/rl_evaluator.py
95
+ +++ b/gia/eval/rl/rl_evaluator.py
96
+ @@ -8,6 +8,10 @@ from gia.eval.rl.gia_agent import GiaAgent
97
+
98
+
99
+ class RLEvaluator(Evaluator):
100
+ + def __init__(self, args, task):
101
+ + super().__init__(args, task)
102
+ + self.agent = GiaAgent()
103
+ +
104
+ def _build_env(self) -> VectorEnv: # TODO: maybe just a gym.Env ?
105
+ raise NotImplementedError
106
+
107
+ diff --git a/gia/eval/rl/scores_dict.json b/gia/eval/rl/scores_dict.json
108
+ index 1b8ebee..ff7d030 100644
109
+ --- a/gia/eval/rl/scores_dict.json
110
+ +++ b/gia/eval/rl/scores_dict.json
111
+ @@ -929,8 +929,8 @@
112
+ },
113
+ "metaworld-assembly": {
114
+ "expert": {
115
+ - "mean": 311.29314618777823,
116
+ - "std": 75.04282151450695
117
+ + "mean": 3523.81468486244,
118
+ + "std": 63.22745220327798
119
+ },
120
+ "random": {
121
+ "mean": 220.65601680730813,
replay.mp4 ADDED
Binary file (576 kB). View file
 
sf_log.txt ADDED
The diff for this file is too large to render. See raw diff