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

Batching in common model training #79

Merged

Conversation

Anya497
Copy link
Collaborator

@Anya497 Anya497 commented Nov 23, 2023

Add new way to train models with generated dataset divided into batches in order to have the opportunity to shuffle steps.
The process consists of three parts:

  • dataset generation
    • saves steps of the best models trained by genetic learning
  • training with batches
    • trains model with gradient descent and generated dataset
    • learning model can be pretrained and taken from the directory "models" or created by customer
    • hyperparameters tune with simple random tuner
  • validation
    • evaluates trained model each epoch
    • runs in parallel
    • during the process results of the learning model are compared with results in the dataset and saved steps are updated if the results of the current model are better

VSharp.ML.AIAgent/learning/play_game.py Outdated Show resolved Hide resolved
VSharp.ML.AIAgent/ml/common_model/dataset.py Outdated Show resolved Hide resolved
VSharp.ML.AIAgent/ml/common_model/dataset.py Outdated Show resolved Hide resolved
VSharp.ML.AIAgent/ml/common_model/dataset.py Show resolved Hide resolved
VSharp.ML.AIAgent/ml/common_model/models.py Outdated Show resolved Hide resolved
VSharp.ML.AIAgent/ml/models/TAGSageTeacher/model.py Outdated Show resolved Hide resolved
VSharp.ML.AIAgent/run_common_model_training.py Outdated Show resolved Hide resolved
VSharp.ML.AIAgent/run_common_model_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.

Я пару вещей не понял, на пару вещей не ответила, запросил изменения еще раз

Обычно при ревью отвечают на все комментарии, так я буду знать, на что ты обратила внимание, а что нет. Можно даже ставить

  • вот такие галочки

и ими отмечать то, что ты сделала. мне сейчас пришлось заново пересматривать весь реквест, чтобы понять что ты поправила, а что нет

+ еще просьба: пожалуйста сначала влей мои изменения, потом делай коммит, иначе мне снова придется решать конфликты

VSharp.ML.AIAgent/ml/common_model/dataset.py Show resolved Hide resolved
def get_model(path_to_weights: Path, model: torch.nn.Module):
weights = torch.load(path_to_weights)
weights["lin_last.weight"] = torch.tensor(np.random.random([1, 8]))
weights["lin_last.bias"] = torch.tensor(np.random.random([1]))
Copy link
Collaborator

@emnigma emnigma Nov 30, 2023

Choose a reason for hiding this comment

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

тык (это про прошлый коммент: lin_last можно убрать, выставив в Linear атрибут bias=False)

разобрались

best_model_score[map_name],
best_model_name,
)
return best_models
Copy link
Collaborator

@emnigma emnigma Nov 30, 2023

Choose a reason for hiding this comment

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

вот этот return заканчивается когда заканчивается первая эпоха, а цикл 48: for epoch_num in range(1, len(os.listdir(csv_path)) + 1): еще не истощился, почему так? посмотри пожалуйста

Copy link
Collaborator

Choose a reason for hiding this comment

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

надо пофиксить

  • пофиксить

VSharp.ML.AIAgent/ml/common_model/utils.py Show resolved Hide resolved

import torch
import torch.nn as nn
import numpy as np
Copy link
Collaborator

Choose a reason for hiding this comment

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

зачем второй раз импортировать numpy? найди пожалуйста оптимизатор импортов

тут я пока ребейзил поковырялся, импорты поправил, забей

VSharp.ML.AIAgent/run_common_model_training.py Outdated Show resolved Hide resolved
@emnigma emnigma mentioned this pull request Dec 5, 2023
@emnigma emnigma merged commit 0df023e into PySymGym:mlSearcher Dec 5, 2023
1 check passed
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.

2 participants