Skip to content

Commit

Permalink
fix: @tensorflow/tfjs-node
Browse files Browse the repository at this point in the history
  • Loading branch information
chaxus committed Nov 4, 2023
1 parent 7e9c2aa commit ec05152
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
# Active LTS + other OS
- os: macos-latest
node_version: 18
# - os: windows-latest @tensorflow/tfjs-node in window has problem
# node_version: 18
- os: windows-latest
node_version: 18
fail-fast: false
name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}"
steps:
Expand All @@ -39,6 +39,9 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: prepare
run: pnpm pre

- name: Install deps
run: pnpm install

Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ dist/
LICENSE.md
pnpm-lock.yaml
pnpm-workspace.yaml
assets
assets
.vscode
2 changes: 2 additions & 0 deletions bin/preinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# @tensorflow/tfjs-node in github actions
pnpm i -g node-gyp
7 changes: 0 additions & 7 deletions bin/preinstall.ts

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"node": ">=16.0.0"
},
"scripts": {
"pre": "sh ./bin/preinstall.sh",
"preinstall": "npx only-allow pnpm",
"clean": "sh ./bin/clean.sh",
"build": "sh ./bin/build.sh",
Expand Down
1 change: 1 addition & 0 deletions packages/ml/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import * as tf from '@tensorflow/tfjs';
import { createLotsOfTensors } from './lib';

const App = () => {
// Define a model for linear regression.
Expand Down
4 changes: 3 additions & 1 deletion packages/ml/client/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export function createLotsOfTensors(): void {
const b = tf.scalar(i)
a.mul(b).print()
}
}
}

export const cleanMemoryCreateLotsOfTensors = tf.tidy(createLotsOfTensors)

0 comments on commit ec05152

Please sign in to comment.