[llvm] [IR2Vec] Changes to support programmatic creation of Vocabulary (PR #177348)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 22 21:21:24 PST 2026
================
@@ -327,6 +327,16 @@ class Vocabulary {
Vocabulary(Vocabulary &&) = default;
Vocabulary &operator=(Vocabulary &&Other) = delete;
+ /// Create a Vocabulary by loading embeddings from a JSON file.
+ /// This is the primary entry point for programmatic vocabulary creation,
+ /// suitable for use in Python bindings or other contexts where command-line
+ /// options are not available. Weights are applied to scale the embeddings
+ /// for opcodes, types, and arguments respectively.
+ LLVM_ABI static Expected<Vocabulary> fromFile(StringRef VocabFilePath,
+ float OpcWeight = 1.0,
----------------
mtrofin wrote:
would these make sense to come from flag values?
https://github.com/llvm/llvm-project/pull/177348
More information about the llvm-commits
mailing list