Skip to main content

A tool package

Project description

Introduction

This is toanstt's library Repository: https://github.com/nmtoan91/pytoansttlib Pipy 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.0.8.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

toansttlib-2.0.8-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file toansttlib-2.0.8.tar.gz.

File metadata

  • Download URL: toansttlib-2.0.8.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for toansttlib-2.0.8.tar.gz
Algorithm Hash digest
SHA256 684146eab30d6317444979a879a7e8270ebfcd7107256e006104a2c40e66726d
MD5 3d21ba65392df923bf52f6b6dd599ea7
BLAKE2b-256 6c2a4ef1477466e0ab00113312654eead97a6cfc9405c0803c3dd300669261a9

See more details on using hashes here.

File details

Details for the file toansttlib-2.0.8-py3-none-any.whl.

File metadata

  • Download URL: toansttlib-2.0.8-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for toansttlib-2.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9f074c2bb4c22f42ccce5c1605de2acda9bfcc0ac22c76e3e8eafaab2d2f6cbf
MD5 bc85e8d9999809e3a2407ef8aa08df2f
BLAKE2b-256 ff493512afd14e1031e97b3ded79dc9521a52615ad21875e5856501ff55a1548

See more details on using hashes here.

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