How rmr327/llmembeddingxrvizualization works
Project Type and Purpose
• This is a Python-based CLI/library tool (with an optional Streamlit UI) for fetching LLM embeddings from Hugging Face, applying dimensionality-reduction algorithms, exporting the result as a 3D model (.dae), and viewing it in XR headsets (e.g., Meta Quest).
• It’s distributed as a PyPI package and tested via GitHub Actions.
Key Architectural Components
a. Entry Points
• CLI (llm-embedding-viz)
• Streamlit dashboard (streamlit.py)
b. Core Library Modules (mylib/)
• get_hugging_face_embeding.py – connects to Hugging Face API, retrieves embeddings
• plotverse_xr_llm.py – applies dimensionality-reduction (PCA, t-SNE, UMAP, MDS, ISOMAP) and builds the 3D scene graph
• 3D Exporter – serializes scene graph into .dae files for XR consumption
c. External Services & Dependencies
• Hugging Face Model Hub (external REST API)
• Python libs: NumPy, scikit-learn/UMAP/t-SNE libraries, streamlit, pycollada (or similar) for .dae
d. Output & Visualization
• Generated .dae file consumed by any COLLADA-compatible viewer or Meta Quest XR app
• (Optional) Web preview via example website
Data Flow & Interactions
1. User runs CLI or Streamlit UI
2. The tool calls Hugging Face API → retrieves high-dimensional embeddings
3. Embeddings fed into selected dimensionality-reduction algorithm
4. Reduced 3D coordinates assembled into a COLLADA scene graph
5. .dae file written to disk
6. User loads .dae in XR viewer on Meta Quest or web preview
Architectural Patterns & Principles
• Pipeline / ETL pattern: fetch → transform → export
• Modular design: separate concerns (data access, transformation, export, UI)
• Dependency injection via CLI args or function parameters (model name, reduction method, labels CSV)
• Test suite isolates data-fetch and transform logic (tests/)