Skip to content

Instantly share code, notes, and snippets.

View javichur's full-sized avatar
🏠
Working from home

Javier Campos javichur

🏠
Working from home
View GitHub Profile
@javichur
javichur / modeling_bart_custom_fragment.py
Created April 22, 2021 15:56
modeling_bart_for_custom_generation_custom_loss
# Original version: https://github.com/huggingface/transformers/blob/master/src/transformers/models/bart/modeling_bart.py
# Attempt for NLP Spain AI challenge (http://www.spain-ai.com/hackathon2020_reto_NLP.php)
# Loss_v2 = num_productos_no_acertados + porcentaje_tokens_no_acertados + 0,001 * default_loss
lm_logits = self.lm_head(outputs[0]) + self.final_logits_bias
masked_lm_loss = None
if labels is not None:
BATCH_SIZE = 8
cuda0 = torch.device('cuda:0')
Receta (desde Windows, con WSL2):
# git clone https://github.com/aws-deepracer-community/deepracer-for-cloud # clonar repo (solo la 1ª vez).
# sudo apt-get install jq awscli python3-boto3 docker-compose # instalar dependencias (solo la 1ª vez).
# docker swarm leave --force
bin/init.sh -a cpu -c local
# aws configure --profile minio # Configurar un perfil para S3 local (solo la 1ª vez).