Skip to main content

A tool package

Project description

Introduction

This is toanstt's library
Repository: https://github.com/nmtoan91/pytoansttlib
Pypi repo: https://pypi.org/project/toansttlib/

TChart usage example

from toansttlib import *
import pandas as pd
import os
import matplotlib.pyplot as plt
import numpy as np
import shutil
#datasetIds = ['Cafe_Chatbot','Dialog','Emotions_MultiTurnDiag','Question_Answer_1','Question_Answer_2','Question_Answer_3','WikiQA']
datasetIds = ['Dialog','Emotions_MultiTurnDiag','Question_Answer_1','Question_Answer_2','Question_Answer_3','WikiQA']

#params = { "text.usetex" : True,"font.family" : "serif", "font.serif" : ["Computer Modern Serif"]}
params = { "text.usetex" : False,"font.family" : "serif"}
plt.rcParams.update(params)
fig, axs = plt.subplots(1,2, figsize=(8, 4))


fig.tight_layout(pad=2.0)
fig.subplots_adjust(bottom=0.3)
ys = []
ys_time=[]
for i in range(6):
    data = pd.read_csv('./FigureDraw/TESTING_epoch/training__home_nmtoan_DATA_CHATBOT_'+datasetIds[i]+'_glue_.csv')
    x = data.epoch.to_numpy()
    y = data.train_loss.to_numpy()
    ys.append(y)
    ys_time.append(data.train_time.to_numpy())
fmta(-1)
DrawSubFigure_SimpleLine(axs[0],x,ys,x_title='epochs',y_title='Loss')
fmta(-1)
DrawSubFigure_SimpleLine(axs[1],x,ys_time,x_title='epochs',y_title='Training time (seconds)')

axs[0].legend(datasetIds,ncol=3,bbox_to_anchor=(1.6, -0.65, 0.5, 0.5))


fileName = './FigureDraw/'+os.path.basename(__file__).replace(".py",".pdf")
fileName2 = "C:/Users/nmtoa/Dropbox/Apps/Overleaf/Toan_ContextBasedFineTuneGPT2/Figures/" + os.path.basename(__file__).replace(".py",".pdf")
plt.savefig(fileName)
shutil.copyfile(fileName,fileName2 )

plt.show()

TChart usage example

from toansttlib import TCSVResult
result = TCSVResult('stage3')
result.Add('Dataset', datasetID)
result.WriteResultToCSV(folder="RESULT/stage3")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toansttlib-2.11.0.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

toansttlib-2.11.0-py3-none-any.whl (8.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page