{"id":15066276,"url":"https://github.com/krakencl/krakenkit","last_synced_at":"2025-04-10T17:33:50.729Z","repository":{"id":63915668,"uuid":"165829198","full_name":"KrakenCL/KrakenKit","owner":"KrakenCL","description":"TensorFlow ToolKit for Swift. ","archived":false,"fork":false,"pushed_at":"2019-03-04T12:09:10.000Z","size":423,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T09:40:47.629Z","etag":null,"topics":["ml","protobuf","swift","tensorboard","tensorflow"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KrakenCL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-15T10:11:58.000Z","updated_at":"2024-11-11T04:47:01.000Z","dependencies_parsed_at":"2023-01-14T13:31:12.223Z","dependency_job_id":null,"html_url":"https://github.com/KrakenCL/KrakenKit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KrakenCL%2FKrakenKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KrakenCL%2FKrakenKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KrakenCL%2FKrakenKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KrakenCL%2FKrakenKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KrakenCL","download_url":"https://codeload.github.com/KrakenCL/KrakenKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262020,"owners_count":21074229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ml","protobuf","swift","tensorboard","tensorflow"],"created_at":"2024-09-25T01:04:57.734Z","updated_at":"2025-04-10T17:33:50.696Z","avatar_url":"https://github.com/KrakenCL.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KrakenKit\n\n\n![scalars](https://raw.githubusercontent.com/KrakenCL/HOWTO/master/docs/scalars.png)\nKrakenKit is [swift](https://swift.org) package for tracking and logging your `Tensor` and export it in to [TensorBoard](https://www.tensorflow.org/guide/summaries_and_tensorboard) visualization tool to represent:  \n* Scalars\n* Images\n* Distributions\n* Histograms\n\n\n\n## HOW TO\n[There is How To](https://github.com/KrakenCL/HOWTO/) repository with examples of use KrakenKit. Please, review it. \n\n## Download Swift for TensorFlow latest toolchain.\nThere is [installation guide](https://github.com/tensorflow/swift/blob/master/Installation.md)\n\n\n## Setup your environment\n```\n$ export PATH=\"${PATH}\":/Library/Developer/Toolchains/swift-latest/usr/bin/\n```\n\n\n\n## Add `KrakenKit` to your `Package.swift` file.\n```\ndependencies: [\n.package(url: \"https://github.com/KrakenCL/KrakenKit.git\", from: \"0.0.1\")\n],\n```\n\n\n\n## Install PNG library\n`KrakenKit` using libpng to make images. In that case you have to install it on your OS.\n\n### Install libpng and pkg-conf\n\nOn MacOS using brew:\n```\n$ brew install pkgconfig libpng\n```\n\non Linux apt:\n```\n$ sudo apt install pkgconfig libpng\n```\n\n\n\n## Add `FileWriter` and `Summary` to your project.\n```\nimport KrakenKit\n\nguard let fileWriterURL = URL(string: logFolder), let fileWriter = try? FileWriter(folder: fileWriterURL, identifier: \"MNIST\") else {\nprint(\"Can't prepare FileWriter.\")\nexit(0)\n}\n\nlet summary = Summary()\n\n# Add histogram\nsummary.histogram(tensor: classifier.layer1.weight, tag: \"layer1/weight\")\nsummary.histogram(tensor: classifier.layer2.bias, tag: \"layer1/bias\")\n\nsummary.add(scalar: accuracy, tag: \"Accuracy\")\nsummary.add(scalar: totalLoss, tag: \"TotalLoss\")\n\n# Save Summary in log file \ntry! fileWriter.add(summary: summary, step: epoch)\n\n```\n\n\n\n## Select example\n```\n$ cd TensorBoardMNIST\n```\n\n\n\n## Build package \n```\n$ /Library/Developer/Toolchains/swift-latest/usr/bin/swift build\n```\n\n\n\n## Run package\n```\n$ /Library/Developer/Toolchains/swift-latest/usr/bin/swift run TensorBoardMNIST -r ./Resources/ -l /tmp/mnist/\n```\n\n\n\n## Run TensorBoard\n```\n$ tensorboard --logdir=/tmp/mnist/\n```\n![scalars](https://raw.githubusercontent.com/KrakenCL/HOWTO/master/docs/scalars.png)\n![scalars](https://raw.githubusercontent.com/KrakenCL/HOWTO/master/docs/images.png)\n![scalars](https://raw.githubusercontent.com/KrakenCL/HOWTO/master/docs/distributions.png)\n![scalars](https://raw.githubusercontent.com/KrakenCL/HOWTO/master/docs/histograms.png)\n\n\n\n## Result output\n```\nReading data.\nConstructing data tensors.\n[Epoch 0] Loss: 930.70416, Accuracy: 54404/60000 (0.90673333)\n[Epoch 1] Loss: 471.11563, Accuracy: 57198/60000 (0.9533)\n[Epoch 2] Loss: 385.83334, Accuracy: 57708/60000 (0.9618)\n[Epoch 3] Loss: 341.75372, Accuracy: 57977/60000 (0.9662833)\n[Epoch 4] Loss: 315.96713, Accuracy: 58138/60000 (0.96896666)\n[Epoch 5] Loss: 295.0858, Accuracy: 58264/60000 (0.97106665)\n[Epoch 6] Loss: 277.12878, Accuracy: 58376/60000 (0.97293335)\n[Epoch 7] Loss: 260.66986, Accuracy: 58468/60000 (0.9744667)\n[Epoch 8] Loss: 249.83846, Accuracy: 58549/60000 (0.97581667)\n[Epoch 9] Loss: 236.19797, Accuracy: 58611/60000 (0.97685)\n[Epoch 10] Loss: 226.43375, Accuracy: 58646/60000 (0.9774333)\n[Epoch 11] Loss: 225.84409, Accuracy: 58620/60000 (0.977)\n[Epoch 12] Loss: 220.47653, Accuracy: 58672/60000 (0.97786665)\n[Epoch 13] Loss: 208.67802, Accuracy: 58705/60000 (0.9784167)\n[Epoch 14] Loss: 214.70064, Accuracy: 58698/60000 (0.9783)\n[Epoch 15] Loss: 205.07307, Accuracy: 58769/60000 (0.9794833)\n[Epoch 16] Loss: 194.5632, Accuracy: 58824/60000 (0.9804)\n[Epoch 17] Loss: 191.91891, Accuracy: 58828/60000 (0.98046666)\n[Epoch 18] Loss: 191.05554, Accuracy: 58850/60000 (0.98083335)\n[Epoch 19] Loss: 184.42844, Accuracy: 58903/60000 (0.9817167)\n\n```\n\n\n\n## Generate Xcode porject file \n```\n$ /Library/Developer/Toolchains/swift-latest/usr/bin/swift package generate-xcodeproj\n```\nSetup project \nCheck Toolchain [Installation](https://github.com/tensorflow/swift/blob/master/Installation.md) instruction. \n1) Set Xcode-\u003eToolchains,  select TensorFlow Swift  Toolchains.\n2) File-\u003e 'Project Settings...'-\u003e Build system -\u003e select 'Legay Build System'.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakencl%2Fkrakenkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrakencl%2Fkrakenkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakencl%2Fkrakenkit/lists"}