More information about HFInference #88
-
When I show HFInference I get this output:
I want to be able to parse, stringify or call the seperate objects or methods, just to get data about them, but can't seem to get anything working. Any suggestions @coyotte508 @radames ? It is a class so I should be able to look at the individual methods and properties. example output here. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 2 replies
-
https://stackoverflow.com/questions/31423573/how-to-enumerate-es6-class-methods no ? const {HfInference} = require("@huggingface/inference");
const hf = new HfInference()
for (const key of Object.getOwnPropertyNames(Object.getPrototypeOf(hf))) {
console.log(key, typeof hf[key], hf[key]);
} It's not really a HF inference question but a javascript question. Also, you have the sources available on github. And https://huggingface.co/docs/huggingface.js/inference/classes/HfInference . |
Beta Was this translation helpful? Give feedback.
-
@coyotte508 your right, sorry about that, but thanks for the JS code. I had tried some stringify tricks which were not responding as normal. |
Beta Was this translation helpful? Give feedback.
-
@coyotte508 Code works great. That is a lot of information! |
Beta Was this translation helpful? Give feedback.
-
I guess stringify does not work because most of the data is a function definition not really a string. I will mess with it a bit. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
LOL, now that I have printed it, it is just a list of the functions in https://huggingface.co/docs/huggingface.js/inference/classes/HfInference oh well it was a learning experience. Thanks for the help. |
Beta Was this translation helpful? Give feedback.
https://stackoverflow.com/questions/31423573/how-to-enumerate-es6-class-methods no ?
It's not really a HF inference question but a javascript question.
Also, you have the sources available on github. And https://huggingface.co/docs/huggingface.js/inference/classes/HfInference .