neptune-client: BUG: neptune.api_exceptions.SSLError: SSL certificate validation failed

I am unable to log to neptune ai and it showing following error neptune.api_exceptions.SSLError: SSL certificate validation failed. Set NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE environment variable to accept self-signed certificates.

Specs pytorch-lightning==1.5.0
neptune-client==0.13.1
Ubunto 20.04
Python 3.8.10

CODE

class OurModel(LightningModule):
    def __init__(self):
        super(OurModel,self).__init__()
        self.model =  timm.create_model(model_name,pretrained=True)
        self.fc1=nn.Linear(1000,500)
        self.relu=nn.ReLU()
        self.fc2= nn.Linear(500,1)
        #parameters
        self.lr=1e-3
        self.batch_size=72
        self.numworker=18
        self.acc = torchmetrics.Accuracy()
        self.criterion=nn.BCEWithLogitsLoss()

    def forward(self,x):
        x= self.model(x)
        x=self.fc1(x)
        x=self.relu(x)
        x=self.fc2(x)
        return x

    def configure_optimizers(self):
        opt=torch.optim.Adam(params=self.parameters(),lr=self.lr )
        scheduler=CosineAnnealingLR(opt,T_max=10,  eta_min=1e-6, last_epoch=-1)
        return {'optimizer': opt,'lr_scheduler':scheduler}

        
    def train_dataloader(self):
        return DataLoader(DataReader(df_train,aug), batch_size = self.batch_size, 
                          num_workers=self.numworker,pin_memory=True,shuffle=True)

    def training_step(self,batch,batch_idx):
        image,label=batch
        out = self(image).view(-1)
        loss=self.criterion(out,label.float())
        acc=self.acc(out,label.long())
        return {'loss':loss,'acc':acc}

    def training_epoch_end(self, outputs):
        loss=torch.stack([x["loss"] for x in outputs]).mean().detach().cpu().numpy().round(2)
        acc=torch.stack([x["acc"] for x in outputs]).mean().detach().cpu().numpy().round(2)
        self.trainacc.append(acc)
        self.trainloss.append(loss)
        self.log('train_loss', loss)
        self.log('train_acc', acc)
        
    def val_dataloader(self):
        ds=DataLoader(DataReader(df_val,aug), batch_size = self.batch_size,
                      num_workers=self.numworker,pin_memory=True, shuffle=False)
        return ds

    def validation_step(self,batch,batch_idx):
        image,label=batch
        out=self(image).view(-1)
        loss=self.criterion(out,label.float())
        acc=self.acc(out,label.long())
        return {'loss':loss,'acc':acc}

    def validation_epoch_end(self, outputs):
        loss=torch.stack([x["loss"] for x in outputs]).mean().detach().cpu().numpy().round(2)
        acc=torch.stack([x["acc"] for x in outputs]).mean().detach().cpu().numpy().round(2)
        self.valacc.append(acc)
        self.valloss.append(loss)
        print('validation loss accuracy ',self.current_epoch,loss, acc)
        self.log('val_loss', loss)
        self.log('val_acc', acc)



model=OurModel()

from pytorch_lightning.loggers import NeptuneLogger
api_token=
neptune_logger = NeptuneLogger(
    api_key=api_token,
    project="abc/xyz",
    name=model_name, 
    tags=[model_name, save_name],
)

seed_everything(0)

checkpoint_callback = ModelCheckpoint(monitor='val_loss',dirpath='checkpoints',
                                      filename='file',save_last=True)
lr_monitor = LearningRateMonitor(logging_interval='epoch')

trainer = Trainer(max_epochs=50,
                  deterministic=True,
                  gpus=-1,precision=16,
                  accumulate_grad_batches=4,
                  enable_progress_bar = False,
                  callbacks=[checkpoint_callback,lr_monitor],
                  logger=neptune_logger
                  )

trainer.fit(model)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (11 by maintainers)

Most upvoted comments

Ok, got it,

Let me check with our engineering team. We will get back with some insights / more info.