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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for toansttlib-2.11.0.tar.gz
Algorithm Hash digest
SHA256 9f490cdfa47a35c6514259ebe2b61aeee780c133e9e50347f28776262f12784d
MD5 27bfb146742cdede4771eb1b19742b9e
BLAKE2b-256 6f34b57283a4b16257277255c8a679b28816d4f9463a459632e63fd147ebec09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: toansttlib-2.11.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for toansttlib-2.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c438636b870beeb2a5cd5457af0c2df2411fd0e782039b3c1105391f2f116592
MD5 6813617e4fecd83148c7cfceb4cbdd71
BLAKE2b-256 da9c31ee93071d037dbe79556d1d20b378411b22be1d6eed94c719505c74fb26

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