I'm new to both Node.js and Tensorflow so I apologize if this is kind of stupid. I'm also new to Stack Overflow so I apologize if this isn't the best-formatted question. I'm trying to implement Tensorflow into a Discord bot(to make a chatbot). I have some experience in Java so I was able to fix some node.js errors, but I can't figure out what this error means as it appears to be a Tensorflow error, not a node.js error and I'm completely new to Tensorflow. One more thing: I am using the provided example code found at https://www.tensorflow.org/js/guide/nodejs except for import * as tf from '@tensorflow/tfjs-node' which I replaced with const tf = require('@tensorflow/tfjs-node'); since import gives an error.
The error I am getting:
2020-03-25 21:02:38.317965: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at summary_kernels.cc:57 : Not found: Failed to create a directory: \/tmp; No such file or directory
(node:3504) UnhandledPromiseRejectionWarning: Error: Invalid TF_Status: 5
Message: Failed to create a directory: \/tmp; No such file or directory
at NodeJSKernelBackend.executeMultipleOutputs (C:\Users\BCG04\node_modules\@tensorflow\tfjs-node\dist\nodejs_kernel_backend.js:206:43)
at NodeJSKernelBackend.createSummaryFileWriter (C:\Users\BCG04\node_modules\@tensorflow\tfjs-node\dist\nodejs_kernel_backend.js:1580:14)
at Object.summaryFileWriter (C:\Users\BCG04\node_modules\@tensorflow\tfjs-node\dist\tensorboard.js:98:17)
at TensorBoardCallback.ensureValWriterCreated (C:\Users\BCG04\node_modules\@tensorflow\tfjs-node\dist\callbacks.js:310:40)
at TensorBoardCallback.logMetrics (C:\Users\BCG04\node_modules\@tensorflow\tfjs-node\dist\callbacks.js:296:22)
at TensorBoardCallback.<anonymous> (C:\Users\BCG04\node_modules\@tensorflow\tfjs-node\dist\callbacks.js:262:26)
at step (C:\Users\BCG04\node_modules\@tensorflow\tfjs-node\dist\callbacks.js:61:23)
at Object.next (C:\Users\BCG04\node_modules\@tensorflow\tfjs-node\dist\callbacks.js:42:53)
at C:\Users\BCG04\node_modules\@tensorflow\tfjs-node\dist\callbacks.js:36:71
at new Promise (<anonymous>)
(node:3504) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:3504) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This is the code with the error:
client.once('ready', () => {
//Start TENSORFLOW tests
const model = tf.sequential();
model.add(tf.layers.dense({ units: 1, inputShape: [200] }));
model.compile({
loss: 'meanSquaredError',
optimizer: 'sgd',
metrics: ['MAE']
});
// Generate some random fake data for demo purpose.
const xs = tf.randomUniform([10000, 200]);
const ys = tf.randomUniform([10000, 1]);
const valXs = tf.randomUniform([1000, 200]);
const valYs = tf.randomUniform([1000, 1]);
// Start model training process.
async function train() {
await model.fit(xs, ys, {
epochs: 100,
validationData: [valXs, valYs],
// Add the tensorBoard callback here.
callbacks: tf.node.tensorBoard('/tmp/fit_logs_1')
});
}
train();
//End TENSORFLOW tests
console.log('Ready!');
console.log("Servers:")
client.guilds.cache.map((guild) => {
console.log(" - " + guild.name)
// List all channels
client.guilds.cache.map((channel) => {
console.log(` -- ${channel.name} (${channel.type}) - ${channel.id}`)
});
});
});