Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gameserver update #66

Merged
merged 30 commits into from
Jul 4, 2024
Merged

Gameserver update #66

merged 30 commits into from
Jul 4, 2024

Conversation

Parzival-05
Copy link
Collaborator

@Parzival-05 Parzival-05 commented May 21, 2024

  1. Убран параллельный запуск, теперь обучение запускается по очереди.
  2. Теперь при обучения в файле c логами отображается статус каждого сеанса обучения
  3. Целевая функция абстрагирована от svm_info, теперь информация о svm хранится в карте
  4. Process pool ловит ошибки и, в случае падения одной из SVM, обучение не прерывается (хотя выглядит это удручающе)
  5. Информация о гиперпараметрах обучения есть лишь в лог файлах, в папке run_tables.
  6. Изменен конфигурационный файл, см. здесь. Добавлена валидация конфига c pydantic. Парсинг конфига стал приятнее.
Пример нового лог файла:
VSharp : status=finished, epochs=2, batch_size=109, lr=0.0003, num_hops_1=5, num_hops_2=4, num_of_state_features=30
VSharp2 : status=finished, epochs=1, batch_size=109, lr=0.0003, num_hops_1=5, num_hops_2=4, num_of_state_features=30
Epoch#0 Average coverage: 64.82142857142857
Average coverage of VSharp = 62.714285714285715
Average coverage of VSharp2 = 66.92857142857143
+-------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+----------------------------------------------------------+----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+----------------------------------------------------------+----------------------------------------------------------+
|             | VSharp : BinarySearch_0                                   | VSharp : BinarySearch_100_BFS                             | VSharp : BinarySearch_100_DFS                             | VSharp : NestedFors_0                                     | VSharp : Combination.Find_0                               | VSharp : BpTree.Delete_0                                  | VSharp : CompactList.LastIndexOf_0                         | VSharp : CompactList.Add_0                                 | VSharp : BubbleSorter.BubbleSortAscending_0               | VSharp : DiscHasher.OldHash_0                             | VSharp : DiskIIController.ReadIoRegionC0C0_0             | VSharp : SlotValueHelper.AreCompatible_0                 | VSharp : LiteEngine.DropCollection_0                      | VSharp : LiteEngine.Delete_0                              | VSharp2 : BinarySearch_0                                  | VSharp2 : BinarySearch_100_BFS                            | VSharp2 : BinarySearch_100_DFS                            | VSharp2 : NestedFors_0                                    | VSharp2 : Combination.Find_0                              | VSharp2 : BpTree.Delete_0                                 | VSharp2 : CompactList.LastIndexOf_0                       | VSharp2 : CompactList.Add_0                                | VSharp2 : BubbleSorter.BubbleSortAscending_0               | VSharp2 : DiscHasher.OldHash_0                            | VSharp2 : DiskIIController.ReadIoRegionC0C0_0             | VSharp2 : SlotValueHelper.AreCompatible_0                 | VSharp2 : LiteEngine.DropCollection_0                    | VSharp2 : LiteEngine.Delete_0                            |
|-------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+----------------------------------------------------------+----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+----------------------------------------------------------+----------------------------------------------------------|
| Game result | actual %: 76.00, steps: 200, test count: 5 error count: 0 | actual %: 90.00, steps: 200, test count: 5 error count: 1 | actual %: 76.00, steps: 200, test count: 5 error count: 0 | actual %: 100.00, steps: 38, test count: 1 error count: 0 | actual %: 66.00, steps: 200, test count: 0 error count: 1 | actual %: 13.00, steps: 200, test count: 1 error count: 6 | actual %: 100.00, steps: 121, test count: 6 error count: 1 | actual %: 100.00, steps: 145, test count: 3 error count: 0 | actual %: 100.00, steps: 76, test count: 1 error count: 1 | actual %: 42.00, steps: 200, test count: 1 error count: 7 | actual %: 0.00, steps: 200, test count: 0 error count: 0 | actual %: 0.00, steps: 200, test count: 0 error count: 0 | actual %: 55.00, steps: 200, test count: 1 error count: 0 | actual %: 60.00, steps: 200, test count: 1 error count: 0 | actual %: 100.00, steps: 63, test count: 6 error count: 0 | actual %: 100.00, steps: 23, test count: 7 error count: 0 | actual %: 100.00, steps: 21, test count: 7 error count: 0 | actual %: 100.00, steps: 40, test count: 2 error count: 0 | actual %: 100.00, steps: 37, test count: 1 error count: 0 | actual %: 13.00, steps: 200, test count: 1 error count: 6 | actual %: 96.00, steps: 200, test count: 5 error count: 2 | actual %: 100.00, steps: 137, test count: 3 error count: 1 | actual %: 100.00, steps: 108, test count: 2 error count: 1 | actual %: 23.00, steps: 200, test count: 0 error count: 5 | actual %: 14.00, steps: 200, test count: 1 error count: 3 | actual %: 91.00, steps: 200, test count: 1 error count: 0 | actual %: 0.00, steps: 200, test count: 0 error count: 0 | actual %: 0.00, steps: 200, test count: 0 error count: 0 |
+-------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+----------------------------------------------------------+----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+----------------------------------------------------------+----------------------------------------------------------+
Epoch#1 Average coverage: 63.857142857142854
Average coverage of VSharp = 63.857142857142854
+-------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+----------------------------------------------------------+----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+
|             | VSharp : BinarySearch_0                                   | VSharp : BinarySearch_100_BFS                             | VSharp : BinarySearch_100_DFS                             | VSharp : NestedFors_0                                     | VSharp : Combination.Find_0                               | VSharp : BpTree.Delete_0                                  | VSharp : CompactList.LastIndexOf_0                         | VSharp : CompactList.Add_0                                 | VSharp : BubbleSorter.BubbleSortAscending_0               | VSharp : DiscHasher.OldHash_0                             | VSharp : DiskIIController.ReadIoRegionC0C0_0             | VSharp : SlotValueHelper.AreCompatible_0                 | VSharp : LiteEngine.DropCollection_0                      | VSharp : LiteEngine.Delete_0                              |
|-------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+----------------------------------------------------------+----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------|
| Game result | actual %: 92.00, steps: 200, test count: 5 error count: 1 | actual %: 90.00, steps: 200, test count: 5 error count: 1 | actual %: 76.00, steps: 200, test count: 5 error count: 0 | actual %: 100.00, steps: 44, test count: 1 error count: 0 | actual %: 66.00, steps: 200, test count: 0 error count: 1 | actual %: 13.00, steps: 200, test count: 1 error count: 3 | actual %: 100.00, steps: 121, test count: 6 error count: 1 | actual %: 100.00, steps: 145, test count: 3 error count: 0 | actual %: 100.00, steps: 76, test count: 1 error count: 1 | actual %: 42.00, steps: 200, test count: 1 error count: 7 | actual %: 0.00, steps: 200, test count: 0 error count: 0 | actual %: 0.00, steps: 200, test count: 0 error count: 0 | actual %: 55.00, steps: 200, test count: 1 error count: 0 | actual %: 60.00, steps: 200, test count: 1 error count: 0 |
+-------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+------------------------------------------------------------+------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+----------------------------------------------------------+----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------+

@Parzival-05 Parzival-05 marked this pull request as draft May 21, 2024 05:20
@gsvgit gsvgit mentioned this pull request May 21, 2024
@gsvgit gsvgit requested review from Anya497 and emnigma May 21, 2024 06:24
Copy link
Collaborator

@Anya497 Anya497 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сейчас в запуске обучения подразумевается, что всегда будет использоваться символьная машина. Это не так. Важно иметь возможность запускать классическое обучение.
Информация о символьной машине нужна только в play_game. На клиенте она не нужна.
Кажется, отдельная функция run_training лишняя.

AIAgent/ml/training/dataset.py Outdated Show resolved Hide resolved
AIAgent/run_training.py Outdated Show resolved Hide resolved
AIAgent/run_training.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@emnigma emnigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тэгни еще раз пожалуйста, когда Анины штуки поправишь

.gitignore Outdated Show resolved Hide resolved
AIAgent/run_training.py Outdated Show resolved Hide resolved
AIAgent/run_training.py Outdated Show resolved Hide resolved
@Parzival-05
Copy link
Collaborator Author

На клиенте она не нужна.

Нужно переписать коллектор статистики, чтобы не приходилось прокидывать инфу о названии SVM. Сейчас пока занес SVM в карту, далее еще валидацию причешу.

Кажется, отдельная функция run_training лишняя.

Сейчас в main происходит лишь чтение конфига, а полезная работа делегируется run training. Мне кажется такое разделение более логичным.

@Parzival-05 Parzival-05 force-pushed the gameserver-upd branch 3 times, most recently from cc6e86a to a9536ed Compare May 22, 2024 14:51
@Parzival-05 Parzival-05 requested a review from Anya497 May 22, 2024 15:10
@Parzival-05 Parzival-05 marked this pull request as ready for review May 22, 2024 15:12
@Parzival-05
Copy link
Collaborator Author

5. В валидации заменил процесс пул на тред пул, т.к. иначе ошибки не ловятся и падает все обучение.

@emnigma, я попытался с процесс пулом, но при ловле ошибок он зависает. Полагаю, что основным бутылочным горлышком при распараллеливании карт будет общение c сервером, поэтому даже c учетом GIL не должно стать на порядок медленнее.

@Parzival-05 Parzival-05 marked this pull request as ready for review May 22, 2024 16:16
AIAgent/ml/training/validation.py Outdated Show resolved Hide resolved
@Parzival-05
Copy link
Collaborator Author

Parzival-05 commented Jun 3, 2024

Поправил мелочи (или прокомментировал)

@Parzival-05 Parzival-05 requested a review from emnigma June 3, 2024 20:10
Copy link
Collaborator

@emnigma emnigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪

AIAgent/run_training.py Outdated Show resolved Hide resolved
AIAgent/run_training.py Outdated Show resolved Hide resolved
AIAgent/run_training.py Outdated Show resolved Hide resolved
AIAgent/common/classes.py Outdated Show resolved Hide resolved
AIAgent/common/classes.py Show resolved Hide resolved
@Parzival-05 Parzival-05 marked this pull request as draft June 4, 2024 12:50
@emnigma emnigma mentioned this pull request Jun 27, 2024
Anya497 and others added 3 commits July 2, 2024 13:18
Co-authored-by: Max Nigmatulin <40598909+emnigma@users.noreply.github.com>
@Anya497 Anya497 force-pushed the gameserver-upd branch 2 times, most recently from 8b4a10f to a81cd15 Compare July 4, 2024 13:04
AIAgent/run_training.py Outdated Show resolved Hide resolved
@emnigma emnigma marked this pull request as ready for review July 4, 2024 13:28
@gsvgit gsvgit merged commit 5dc7ef5 into dev Jul 4, 2024
6 checks passed
gsvgit pushed a commit that referenced this pull request Oct 14, 2024
* Remove parallel training

* Rename output of training

* Add .mono to gitignore

* Add handling of errors while training

* Add `svm_info` to maps & refactor of training

* Edit specification of config

* Update statistics collector & refactor of training

* Replace thread pool with process pool

* Remove excess field from TrainingConfig

* Refactor of validation

* Refactor of epochs_statistics

* Add SingleSVMInfo class

* Remove excess import

* Add config validation & revised training process

* Add `pydantic` to project

* Edit run_training: make the parameter "server_count" explicitly set

* Minor fixes

* Remove excess `svms_count` field

* Add ignoring of extra fields in `SingleSVMInfo`

* Fix `EpochsInfo`: make it a dataclass

* Edit interface of model saver

* Create single dataset. Merge configs.

* Change optuna studies path.

* Small fixes from comments.

Co-authored-by: Max Nigmatulin <40598909+emnigma@users.noreply.github.com>

* Fix bug with SVMInfo adding.

* Refactor config. Add support of miltiple json files for single platform. One SVM for one platform.

* Remove comments.

* edit 'launch_servers': Add support of usvm

* Fix statistics collector

---------

Co-authored-by: Anya497 <chi.vinny0702@gmail.com>
Co-authored-by: Anya Chistyakova <57658770+Anya497@users.noreply.github.com>
Co-authored-by: Max Nigmatulin <40598909+emnigma@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants