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.0.9.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: toansttlib-2.0.9.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.9.tar.gz
Algorithm Hash digest
SHA256 7cb3503350e0be23641d2b2a889c9cf6879962b7eab0ecd3a35883346817f250
MD5 3fc60bd41df317e69df269f7f1876d23
BLAKE2b-256 8656908312b4b818abd5bd7ceccbd8f71cceeb1a39ad3c1189bf2c51da948354

See more details on using hashes here.

File details

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

File metadata

  • Download URL: toansttlib-2.0.9-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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c74bd3f128edbb2546946e1f93df9327f040485cab067b4d37ac1afd8b681ba2
MD5 ebcfec7b0365c503a5eec53f990810ff
BLAKE2b-256 d947b6f977a690cb78a3d4fdcfe5d0e367bf0b5dc077f5df161384fdbb3563b0

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