GithubHelp home page GithubHelp logo

torch_practice's Introduction

torch practice

Installation

pip install git+https://github.com/ryomazda/torch_practice.git

Running Unit Tests

poetry run pytest -svx --cov pigimaru
# or
docker-compose up --build test

Using GPU

docker build -f docker/Dockerfile.gpu -t gpu-test --target test .
docker run --gpus all --rm -it \
  -e CUDA_VISIBLE_DEVICES=`nvidia-smi --query-gpu=index,memory.used --format=csv,noheader,nounits | awk -F , '$2 == 0' | awk -F , '{print $1}' | head -1` \
  gpu-test

Training

Local (just for test)

poetry install -E train --no-dev
poetry run train \
  --debug \
  path/to/train.tsv \
  path/to/valid.tsv \
  path/to/test.tsv

CPU docker (just for test)

# Only when you wanna update the dependency
docker-compose build train
# Do this every time
docker-compose run --rm train \
  poetry run train \
    --debug \
    path/to/train.tsv \
    path/to/valid.tsv \
    path/to/test.tsv

Using GPU

docker build -f docker/Dockerfile.gpu -t gpu-train --target train .
docker run --gpus all --rm \
  -e CUDA_VISIBLE_DEVICES=`nvidia-smi --query-gpu=index,memory.used --format=csv,noheader,nounits | awk -F , '$2 == 0' | awk -F , '{print $1}' | head -1` \
  -v $PWD:/work \
  -it \
  gpu-train bash
docker run --gpus all --rm \
  -e CUDA_VISIBLE_DEVICES=`nvidia-smi --query-gpu=index,memory.used --format=csv,noheader,nounits | awk -F , '$2 == 0' | awk -F , '{print $1}' | head -1` \
  -v $PWD:/work \
  gpu-train \
    poetry run train --debug \
      path/to/train.tsv path/to/valid.tsv path/to/test.tsv

Running jupyter server

For ad hoc analysis & development. notebooks are supposed to be executed through this jupyter server.

poetry install -E jupyter
poetry run jupyter lab
# or
docker-compose up --build jupyter
# Open `http://localhot:8888` and put "password" as the password.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.