Closed sweep-nightly[bot] closed 1 year ago
src/trainer.py
✓
Sandbox logs for https://github.com/sweepai/evals/commit/f2bead7103060af973be92c2daf04aacdc3174b6
trunk fmt src/trainer.py || exit 0
1/4 ✓✔ Formatted src/trainer.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures src/trainer.py
2/4 ✓✔ Auto-fixed src/trainer.py Re-checking autofixed files... Checked 1 file ✔ No issues
if [[ $(echo "src/trainer.py" | grep 'test.*\.py$') ]]; then PYTHONPATH=. python src/trainer.py; else exit 0; fi
3/4 ✓(nothing was outputted)
if [[ "src/trainer.py" == *test*.py ]]; then PYTHONPATH=. pytest src/trainer.py; else exit 0; fi
4/4 ✓(nothing was outputted)
src/main.py
✓
Sandbox logs for https://github.com/sweepai/evals/commit/42be6649d768bb50c1589087762bac9297fb4acb
trunk fmt src/main.py || exit 0
1/4 ✓✔ Formatted src/main.py Re-checking autofixed files... ✔ Formatted src/main.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures src/main.py
2/4 ✓✔ Auto-fixed src/main.py Re-checking autofixed files... ISSUES src/main.py:1:17 1:17 high `numpy` imported but unused ruff/F401 Checked 1 file 1 existing issue (1 auto-fixable)
if [[ $(echo "src/main.py" | grep 'test.*\.py$') ]]; then PYTHONPATH=. python src/main.py; else exit 0; fi
3/4 ✓(nothing was outputted)
if [[ "src/main.py" == *test*.py ]]; then PYTHONPATH=. pytest src/main.py; else exit 0; fi
4/4 ✓(nothing was outputted)
The command:
Run pip install -r requirements.txt
yielded the following error:
##[error]Process completed with exit code 1.
Here are the logs:
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Using cached annotated_types-0.6.0-py3-none-any.whl.metadata (12 kB)
Using cached anyio-3.7.1-py3-none-any.whl.metadata (4.7 kB)
Using cached astroid-3.0.1-py3-none-any.whl.metadata (4.5 kB)
Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Using cached click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
ERROR: Could not find a version that satisfies the requirement distutils (from versions: none)
ERROR: No matching distribution found for distutils
[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: pip install --upgrade pip
Done.
Description
This PR refactors the training loop from a script to a class in order to improve code organization and reusability. It introduces a new
Trainer
class in thesrc/trainer.py
file that encapsulates the training loop logic. TheTrainer
class takes the model, dataloader, and optimizer as inputs and provides atrain
method to train the model.Summary of Changes
src/trainer.py
to define theTrainer
class.src/main.py
to import and use theTrainer
class.src/main.py
with a call to thetrain
method of theTrainer
instance.Fixes #6.
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can: