{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n", "import json\n", "from os.path import join" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "OUT_DIR = 'output/'\n", "EXP_DIR = join(OUT_DIR, 'semsup_descs_amzn13k_curie_nocoil', 'predictions')" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/n/fs/nlp-pranjal/SemSup-LMLC/training\n" ] } ], "source": [ "%cd .." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "files = dict()\n", "for file in os.listdir(EXP_DIR):\n", " t = float(file.split('_')[-1].replace('.pkl',''))\n", " if t not in files:\n", " files[t] = []\n", " files[t] += [join(EXP_DIR, file)]" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "21.792958695441484" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import itertools\n", "tsize = 0\n", "for file in itertools.chain(*files.values()):\n", " tsize += os.path.getsize(file)\n", "tsize/ (1024**3)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "files = {k:files[k] for k in sorted(files.keys())}" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "10.170047391206026" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import random\n", "tsize = 0\n", "for k in sorted(list(files.keys()))[10:]:\n", " if random.random() > 0.6:\n", " continue\n", " for f in files[k]:\n", " tsize += os.path.getsize(f)\n", " os.remove(f)\n", "tsize/ (1024**3)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "interpreter": { "hash": "90fcbf6f06d9a30c70fdaff45e14c5534421a599dc22a7267c486c9cb67dea6d" }, "kernelspec": { "display_name": "Python 3.9.12 ('base')", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.12" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }