!ls
#Crear la directorio en colab
#Poner el nombr que se desee al directorio
!mkdir dvc5
!pwd
#%rm -Rf dvc5
#Cambiar de directorio
import os
os.chdir("/work/dvc5/dvc5")
!pwd
#Instalar dvc
!pip install dvc
#Crear un repo en Github y clonar dentro del directorio
!git clone https://dagshub.com/turacam2014/dvc5.git
#Verificar si git está activo
!git status
#Inicializar dvc
!dvc init -f
#Commit de git
!git commit -m "Initialize DVC"
#Descargar los datos
#Obiamente pueden provenir de cualquier fuente
!dvc get https://github.com/iterative/dataset-registry \
get-started/data.xml -o data/data.xml
#Agregar los datos al seguimiento de dvc
!dvc add data/data.xml
#Config de git para poder hacer
!git config --global user.name "turacam2014"
!git config --global user.email "turacam2014@gmail.com"
#Agregar los datos al seguimiento de git
!git add data/data.xml.dvc data/.gitignore
#Commit
!git commit -m "Add raw data"
#Verificar en que rama estamos
!git branch
!git status
!git commit -m"your commit"
#Verificar que remoto
!git remote -v
# ELIMINA EL REPO LOCAL si la sentencia anterior informa que ya existe
!git remote rm origin
#Agregar el origin de Github con el token
#En Agosto Github hizo cambio de politicas de seguridad
!git remote add origin https://abf7fe7a1819b4dec866ee33ed91dfc0fc34a458@dagshub.com/turacam2014/dvc5.git
#Push al remoto
!git push -u origin master
!git commit -m "first commit"
#Obtener código
!wget https://code.dvc.org/get-started/code.zip
#Dezipear código
!unzip code.zip
#Instalar requerimientos
!pip install -r src/requirements.txt
!dvc remote add origin https://dagshub.com/turacam2014/dvc5.dvc
!dvc remote modify origin --local auth basic
!dvc remote modify origin --local user turacam2014
!dvc remote modify origin --local password e6481150a542a76906a039707d3306809aaaa8fa
!dvc push -r origin
#Correr etapas de dvc
!dvc run -n prepare \
-p prepare.seed,prepare.split \
-d src/prepare.py -d data/data.xml \
-o data/prepared \
python src/prepare.py data/data.xml
#Correr etapas de dvc
!dvc run -n featurize \
-p featurize.max_features,featurize.ngrams \
-d src/featurization.py -d data/prepared \
-o data/features \
python src/featurization.py data/prepared data/features
#Correr etapas de dvc
!dvc run -n train \
-p train.seed,train.n_est,train.min_split \
-d src/train.py -d data/features \
-o model.pkl \
python src/train.py data/features model.pkl
#Correr etapas de dvc
!dvc run -n evaluate \
-d src/evaluate.py -d model.pkl -d data/features \
-M scores.json \
--plots-no-cache prc.json \
--plots-no-cache roc.json \
python src/evaluate.py model.pkl \
data/features scores.json prc.json roc.json
#Correr etapas de dvc
!dvc metrics show
#Si modificamos parámetros, código fuente, etc
#corremos un repro (reproducir prueba)
!dvc repro
!dvc metrics diff
!pip install Cython
#Cargamos repo remoto para dvc
from google.colab import drive
drive.mount('/work/drive')
!ls /datasets/dvc5
# DEFINO MI REMOTO
# Con este comando podemos hacer el PUSH a un repositorio externo, en este caso el drive.
# Link de doc: https://dvc.org/doc/command-reference/remote/add
# Link para obtener un Token de Drive: https://developers.google.com/identity/protocols/oauth2
!dvc remote add -d storage /content/drive/MyDrive/dvc5/dvcstore
!git add .dvc/config
!git commit -m "Configure remote storage"
!dvc push
!dvc remote add origin https://dagshub.com/turacam2014/dvc5.dvc
!dvc remote modify origin --local auth basic
!dvc remote modify origin --local user turacam2014
!dvc remote modify origin --local password your_token
!dvc push -r origin