Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

convert-hf-to-te

Latest version: vgit:c101ed5f3053fda499db79e9ef0502bee40dbfa5

Overview

Last scanned
26 Nov 2026
Agent skill Publisher: NVIDIA
4,152 Stars
557 Forks
1 Versions
Python Repo language

Scan summary

convert-hf-to-te was last scanned on 26 Nov 2026 at commit c101ed5f. Risk score 1 of 100 (low). No malicious behavior was detected.

  • Releases: Single version.
  • Findings: 2 rules fired in commit c101ed5f (2 low). The score describes this commit only.

Versions

1 version published
Versions and the rules that fired in each
VersionPublishedStatus
c101ed5f 2 rules fired

Rules fired in c101ed5f: 2

Findings

2 Low

Findings for commit c101ed5f. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

Encoded content in a skill

The skill's text or bundled scripts contain encoded content, such as a long base64 or hex string, a dense run of hex escapes, or invisible Unicode tag characters that can carry hidden instructions. Skills rarely need these. On its own this is not evidence of malicious behavior.

LOW

Requests broad command-line access

LOW
Checking access…

🔒 Create a free account to see all 2 findings with descriptions and instance counts

The score describes c101ed5f; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

Convert a Hugging Face model to Transformer Engine

Use the project's requested entry point or add a model-family module such as te_llama.py. Replace compatible building blocks of the Hugging Face (HF) model with Transformer Engine (TE) modules and load the original checkpoint into them. The building block is the whole transformer layer, as for Llama and Gemma, or else the attention (MHA, linear attention) and MLP or MoE blocks inside it. A partial conversion can also replace a single operation inside an HF block. For a review or plan, stop after the requested feasibility, boundary or weight-mapping decision in Steps 1–3. For a local implementation, Step 4 ends at the first BF16 forward comparison. Use Step 5 for requested training checks, integration or performance measurements at the scope the user specified. In this skill te means transformer_engine.pytorch.

In a plan or implementation handoff, lead with the chosen replacement boundary and weight map.

Not for JAX or inference serving (vLLM, TensorRT-LLM). For Megatron-LM or another PyTorch framework, the TE implementation can serve as a reference for which TE modules to use and how the weights map.

1. Check the architecture and feasibility

Identify the training path, representative inputs and target precision from the request and project. Read the model's config.json, checkpoint keys and decoder forward at the requested revision or installed version. For each distinct layer type, record its modules, which tensors they consume or share, and their checkpoint keys. Use this inventory to identify candidate TE modules. Consult examples for the relevant boundary and verify API choices against the target TE release. For source-only work, use those sources to resolve API and layout questions before setting up a runtime.

HF component Candidate TE module
The whole transformer block te.TransformerLayer
Self-attention with QKV and output projections te.MultiheadAttention. Set input_layernorm=True only when it replaces HF's input norm, so the norm runs once.
Scaled dot-product attention on projected Q/K/V te.DotProductAttention
Input norm followed by one linear projection, which can pack compatible projections of the same normalized input te.LayerNormLinear
A norm and a dense MLP te.LayerNormMLP
Grouped linear projections across MoE experts te.ops.GroupedLinear. The surrounding MoE block supplies activation and routing.
Dispatch and combine across expert-parallel ranks te.ops.MoeDispatch and te.ops.MoeCombine in the experimental operation fuser. Check compatibility with the router outputs and backend.
A single projection or norm te.Linear, te.RMSNorm, te.LayerNorm

The table is not exhaustive. Newer architectures may need other TE modules, such as the experimental Gated DeltaNet core (te.GatedDeltaNetAttention). Check that the installed TE exports the candidate and its backend supports the target inputs and workload. Keep unsupported components in HF.

2. Choose the granularity

Start with the largest region that preserves HF's computation and the interface its caller uses. The level describes which part of the HF model you replace.

Level 1: the whole transformer block. Try one te.TransformerLayer for the HF decoder block. Match the attention and MLP widths, query and KV head counts, normalization and residual order, activation, mask, and rotary positions for the requested inputs. A causal HF decoder with only self-attention uses TE's self-attention topology with a causal mask. In TE 2.18, layer_type="decoder" adds cross-attention. When the block matches, substitute it at the HF decoder entry point and preserve the caller's arguments, layout and return value. Map the norm, attention and MLP weights and compare the whole block's BF16 output to HF in Step 4. Llama wrapper · Gemma constructor · TE layer topology

Level 2: attention and MLP separately. If the whole layer does not fit, consider each sublayer independently. Experts and linear attention are two examples from a non-exhaustive list.

  • Attention: use te.MultiheadAttention when it implements the target attention block.
  • MLP: te.LayerNormMLP for a dense MLP. For mixture-of-experts (MoE), compose a model-specific block around the compatible operations. For example, te_mixtral.py defines its own TEMixtralSparseMoeBlock to route tokens, run the expert FFN and combine outputs.

Level 3: an operation inside an HF sublayer. For example, replace a projection inside HF attention or the expert GEMMs inside an HF MoE block. Choose this boundary when you can preserve its inputs, outputs and shared state and have a workload benefit to test. If TE cannot reproduce the attention behavior, keep HF's attention computation, masking, positions and cache together. An independent MLP can still benefit. Keep HF wherever correctness or measured performance favors it.

Choose what to fuse

Choose fusions before mapping weights. Preserve operation order and all consumers of a shared tensor. For example, TE can combine:

  • a norm with the QKV projection: te.LayerNormLinear, or te.MultiheadAttention with input_layernorm=True;
  • a norm with the MLP: te.LayerNormMLP.

Look up other fusions in the PyTorch API and operation fuser guide. Check the installed release for support at the target shapes, dtype and hardware.

3. Map the weights

Use the Step 1 inventory and Step 2 boundaries to map each required HF key or slice to a TE parameter and slice. Record axis, order and intended cast where the layout changes. Preserve tied weights. For expert-parallel MoE, map each global expert ID to its owning rank and local expert parameter. When loading quantized weights into BF16, use the checkpoint's quantization metadata to recover the reference values.

Plan how the loader will track copies across all shards. Require it to fail on any missing required source or destination slice. For packed weights, reconstruct the named HF tensors after loading and compare after the intended cast to catch equal-shaped swaps. Three examples illustrate why the layout matters:

  • Llama gate and up fill separate FC1 halves and can arrive in different shards.
  • Gemma QKV uses different mappings for separate and interleaved projections.
  • Mixtral mappings pack Q heads by KV group and interleave expert gate/up rows for a fused kernel.

4. Implement

Design patterns
  • Substitute at construction when the replacement satisfies the HF caller. Keep the arguments, return values and state used by the workload so the surrounding HF model can call it directly. For example, Llama substitutes its decoder class while HF constructs the causal LM. Llama constructor
  • Compose around model-specific behavior when only part of a block matches. Keep routing or attention state with the code that owns it and attach TE at the boundary chosen in Step 2. For example, Mixtral dispatches routed tokens to its expert FFN, then combines its outputs. Mixtral MoE forward
  • Load after construction so the destination layout exists before applying the Step 3 mapping. Load retained HF parameters by their original mapping and verify the converted weights. For example, Gemma constructs the model before its standard loader maps the decoder weights and copies the retained embeddings. Gemma loader
  • Check each replacement's forward output first. After copying weights, run the original HF computation and its TE replacement in BF16 on the same representative inputs. Match relevant masks, positions, state and stochastic behavior. Choose tolerances for the quantities being compared before running the checks. Compare outputs at the same boundary and in the same layout. For example, for a fused norm and QKV projection, run the HF norm and all three HF projections, then arrange their outputs in the TE head order. A replacement constructed inside the model can be checked directly using captured layer inputs.
When replacement outputs differ

Choose checks that exercise the HF module being compared. These model-specific examples are non-exhaustive.

  • If attention outputs differ, compare the positions each path uses and which keys each query can see. Use an input that exercises the target behavior, such as a boundary in packed data.
  • A norm that multiplies by 1 + weight (Gemma, Qwen3.5) needs zero_centered_gamma=True.
  • Head sizes: pass the attention's real query/key and value head sizes as kv_channels. config.head_dim is not always that; in GLM-5 it is only the RoPE part of each head. For multi-head latent attention, check HF's effective softmax scale and which slice of Q and K receives rotary embeddings before substituting the attention core.
  • Match attention dropout and projection biases to HF. Check the installed module's defaults.
  • HF's post_init() overwrites TE weights; load the checkpoint before training.

5. Validation

Once the replacement outputs match, compare integrated HF and TE outputs on the same BF16 inputs and with the same stochastic controls. For training, match labels and loss reduction, then compare loss and a gradient or optimizer update on a replaced parameter in each changed path. Use the same parameter layout and exercise a routed expert for MoE. If the full model does not fit, start with a deterministic check for each changed layer type and report the layers it covers. When you supply a comparison, put its source entry point, exact command, what it checks and execution status together in the handoff. Report weight mapping coverage and any blockers. When execution is outside scope or unavailable, mark numerical results as unverified. Use FP32 to diagnose discrepancies. If the workload calls for lower-precision execution, repeat the relevant checks with that recipe and its own tolerances.

For requested FP8 training, verify the BF16 port first and choose a TE recipe supported by the installed release, GPU and operation shapes. If the trainer manages TE precision, configure its TE backend. In a manual loop, wrap the model forward in with te.autocast(enabled=True, recipe=fp8_recipe): and call loss.backward() after leaving the context. Keep the baseline parameter and loss dtypes. Compare loss and a gradient or update for a replaced weight against the matched BF16 run using recipe-specific tolerances. Report the FP8 check as pending if the target is unavailable.

Before recommending a speedup, warm up and synchronize end-to-end runs of optimized HF and TE. Compare them first in BF16 with matched effective tokens, batching and GPU topology. Measure a requested precision change separately. Report the HF/TE versions, workload, measured result, regions kept or replaced and why, and mapping and parity evidence. Identify unmeasured results. For training-step timing, see the Llama warmup and timed loop and the Mixtral per-step CUDA events.

Troubleshooting case-study: Qwen3.5

These illustrative troubleshooting notes show how checkpoint, expert and attention issues can surface when instructions in this skill are followed over successive iterations for one example model - Qwen3.5.

Weights are missing or left over (Qwen3.5). Take the names from the checkpoint files, not from model.state_dict(): a checkpoint may stack all experts of a layer in one tensor, and the layer prefix may be deeper (model.language_model.layers.N.). Skip what HF skips (_keys_to_ignore_on_load_unexpected). A model made of sub-models needs every sub-config's dtype set, or HF builds parts of it in float32.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • GitHub NVIDIA/skills/convert-hf-to-te

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Microsoft's Official agent framework Hijacked
AI & VibeSec

BREAKING: Hijacked Releases of Microsoft’s Official agent-framework Steals Azure and CI Credentials

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

CVE

Java4Shell (CVE-2026-114938): Easy to Crash, Hard to Exploit — Less Than 0.12% of JVMs Estimated at Risk of RCE

Frame 2085668439 (1)
Group 1261154229