repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/cmmlu/llama_evaluator.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:19.853006 | # This code is modified from C-Eval Project: https://github.com/SJTU-LIT/ceval
import os
import re
from tqdm import tqdm
import random
import numpy as np
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers import GenerationConfig
DEFAULT_SYSTEM_PROMPT = """You are a helpful as... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/merge_llama3_with_chinese_lora_low_mem.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:19.990865 | """
Usage:
python merge_llama3_with_chinese_lora_low_mem.py \
--base_model path/to/llama-3-hf-model \
--lora_model path/to/llama-3-chinese-lora \
--output_type [huggingface|pth|] \
--output_dir path/to/output-dir
"""
import argparse
import json
import os
import gc
import torch
import peft
from transfor... |
ymcui/Chinese-LLaMA-Alpaca-3 | https://github.com/ymcui/Chinese-LLaMA-Alpaca-3 | null | null | null | null | 1,971 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/training/run_clm_sft_with_peft.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:19.991464 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/app/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:22.729296 | from __future__ import annotations
import requests
from PIL import Image
def cleanup(signum, frame, vllm_server):
print("\nReceived exit signal. Stopping vLLM server...")
vllm_server.stop_server()
exit(0)
def check_vllm_healthcheck(host: str, port: int):
try:
response = requests.get(f"http:... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/metrics/classification.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:22.732539 | from __future__ import annotations
from docext.benchmark.vlm_datasets.ds import Prediction
def get_classification_metrics(pred_with_gt: list[Prediction]):
exact_matches = []
for prediction in pred_with_gt:
gt = prediction.gt
pred = prediction.pred
gt_answer = str(
gt.class... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/app/args.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:22.736649 | from __future__ import annotations
import argparse
def parse_args():
parser = argparse.ArgumentParser(
description="DocExt: Onprem information extraction from documents",
)
parser.add_argument(
"--vlm_server_port",
type=int,
default=8000,
help="Port for the vLLM/OL... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/app/pdf2md.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:22.739293 | from __future__ import annotations
import asyncio
import re
import time
import uuid
from collections.abc import Generator
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
import gradio as gr
from docext.core.pdf2md.pdf2md import convert_to_markdown_stream
from docext.core.utils import ... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/metrics/grits.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:22.739796 | # code from https://github.com/microsoft/table-transformer/blob/main/src/grits.py
from __future__ import annotations
import itertools
import xml.etree.ElementTree as ET
from collections import defaultdict
from difflib import SequenceMatcher
import numpy as np
from fitz import Rect
def compute_fscore(num_true_positi... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/benchmark.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:22.740678 | """
Start point for running the Nanonets IDP benchmark.
Checkout Nanonets for automating information extraction
from documents (like invoices, receipts, purchase orders, bills, etc) and automate workflows: https://nanonets.com/
Author: Souvik Mandal
"""
from __future__ import annotations
import hashlib
import json
... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/app/app.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:22.742436 | from __future__ import annotations
import os
import signal
import gradio as gr
import pandas as pd
from loguru import logger
from docext.app.args import parse_args
from docext.app.pdf2md import pdf_to_markdown_ui
from docext.app.utils import check_ollama_healthcheck
from docext.app.utils import check_vllm_healthchec... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/chartqa.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:24.713474 | """
This file contains code to convert the HuggingFaceM4/ChartQA dataset
into Nanonets IDP format. This is a question answering dataset for charts and plots.
The dataset can be downloaded from:
https://huggingface.co/datasets/HuggingFaceM4/ChartQA
"""
from __future__ import annotations
import os
from datasets import... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/metrics/kie.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:24.748579 | from __future__ import annotations
from typing import List
from Levenshtein import distance as edit_distance
from tqdm import tqdm
from docext.benchmark.vlm_datasets.ds import Prediction
def get_kie_metrics(predictions: list[Prediction]):
"""
Get the metrics for the predictions.
"""
edit_distances ... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:24.820509 | from __future__ import annotations
import base64
import yaml
def load_yaml(path: str) -> dict:
with open(path) as f:
return yaml.safe_load(f)
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode("utf-8")
|
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/checkbox.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:24.822523 | """
This file contains code to convert the Rasi1610/DeathSe43_44_checkbox dataset
into Nanonets IDP format. This is a handwritten form for death certificate.
The dataset can be downloaded from:
https://huggingface.co/datasets/Rasi1610/DeathSe43_44_checkbox
We skip two fields when converting the data:
1. death: Lots o... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/tasks.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:24.852352 | """
Tasks that are supported by the Nanonets IDP benchmark.
Currently following tasks are supported:
1. KIE: Key Information Extraction
2. VQA: Visual Question Answering
3. OCR: Optical Character Recognition
4. Classification: Document Classification
5. LongDocBench: Long Document key information extraction
We plan t... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/metrics/tables.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:24.853571 | from __future__ import annotations
import numpy as np
from docext.benchmark.metrics.grits import grits_from_df
from docext.benchmark.vlm_datasets.ds import Prediction
def get_table_metrics(pred_with_gt: list[Prediction]):
metrics_list = []
for prediction in pred_with_gt:
gt = prediction.gt
p... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/metrics/ocr.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:24.859304 | from __future__ import annotations
from typing import List
from Levenshtein import distance as edit_distance
from docext.benchmark.vlm_datasets.ds import Prediction
def get_ocr_metrics(pred_with_gt: list[Prediction]):
edit_distances = []
for prediction in pred_with_gt:
gt = prediction.gt
pr... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/metrics/vqa.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:24.875279 | from __future__ import annotations
from typing import List
from Levenshtein import distance as edit_distance
from docext.benchmark.vlm_datasets.ds import Prediction
def get_vqa_metrics(pred_with_gt: list[Prediction], strip_page: bool = False):
exact_matches = []
for prediction in pred_with_gt:
gt =... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/docile.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:24.875856 | from __future__ import annotations
import os
from typing import Optional
from loguru import logger
from tqdm import tqdm
from docext.benchmark.vlm_datasets.ds import BBox
from docext.benchmark.vlm_datasets.ds import BenchmarkData
from docext.benchmark.vlm_datasets.ds import BenchmarkDataset
from docext.benchmark.vlm... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/ocr_dia.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:25.641890 | """
This file contains code to convert the ademax/ocr_scan_vi_01 dataset
into Nanonets IDP format. This is a digital OCR dataset with diacritics and
other non-latin characters.
The dataset can be downloaded from:
https://huggingface.co/datasets/ademax/ocr_scan_vi_01
"""
from __future__ import annotations
from typing ... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/nanonets_tablebench.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:25.644276 | from __future__ import annotations
import os
from io import StringIO
import pandas as pd
from datasets import load_dataset
from tqdm import tqdm
from docext.benchmark.vlm_datasets.ds import BenchmarkData
from docext.benchmark.vlm_datasets.ds import BenchmarkDataset
from docext.benchmark.vlm_datasets.ds import Extrac... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/ds.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:25.645568 | from __future__ import annotations
import io
import os
import random
from enum import Enum
from typing import Union
import pandas as pd
from loguru import logger
from PIL import Image
from pydantic import BaseModel
from pydantic import ConfigDict
from tqdm import tqdm
from docext.benchmark.vlm_datasets.utils import ... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/longdocbench.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:25.647017 | """
LongDocBench is a dataset for long document key information extraction.
We concatinate multiple documents together to form a long document.
Then we ask to extract information from one of the such documents.
Eg: Extract fields3, fields4 from the document which has field1=value1, field2=value2.
We put the same docu... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/nanonets_cls.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:25.647921 | """
This file contains code to convert the nanonets/Nanonets-Cls-Full dataset
into Nanonets IDP format. This is a document classification dataset. The dataset
contains single page and multi-page documents.
The dataset can be downloaded from:
https://huggingface.co/datasets/nanonets/Nanonets-Cls-Full
"""
from __future_... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/nanonets_kie.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:26.877074 | """
This file contains code to convert the `nanonets/key_information_extraction` dataset
into Nanonets IDP format. This is a key information extraction dataset. The dataset contains
receipts, and are annotated for following fields:
"date", "doc_no_receipt_no", "seller_address", "seller_gst_id", "seller_name", "seller_p... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/docvqa.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:27.090147 | """
This file contains code to convert the HuggingFaceM4/ChartQA dataset
into Nanonets IDP format. This is a question answering dataset for charts and plots.
The dataset can be downloaded from:
https://huggingface.co/datasets/HuggingFaceM4/ChartQA
"""
from __future__ import annotations
import os
from datasets import... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/ocr_hw.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:27.151033 | """
This file contains code to convert the DataStudio/OCR_handwritting_HAT2023 dataset
into Nanonets IDP format. This is a handwritten OCR dataset.
The dataset can be downloaded from:
https://huggingface.co/datasets/DataStudio/OCR_handwritting_HAT2023
"""
from __future__ import annotations
import os
import random
fro... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/core/confidence.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:27.196389 | from __future__ import annotations
def get_fields_confidence_score_messages_binary(
messages: list[dict],
assistant_response: str,
fields: list[str],
) -> list[dict]:
messages.append({"role": "assistant", "content": assistant_response})
output_format = {field: "High/Low" for field in fields}
m... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/benchmark/vlm_datasets/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:27.197659 | from __future__ import annotations
import json
import os
from typing import List
from pdf2image import convert_from_path
def load_json(path: str):
with open(path) as f:
return json.load(f)
def convert_pdf2image(pdf_path: str, output_dir: str):
"""
Convert a pdf file to a list of image files.
... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/core/client.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:27.256000 | from __future__ import annotations
import os
import requests
from litellm import completion
def sync_request(
messages: list[dict],
model_name: str = "hosted_vllm/Qwen/Qwen2.5-VL-3B-Instruct",
max_tokens: int = 5000,
num_completions: int = 1,
format: dict | None = None,
):
vlm_url = os.geten... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/core/extract.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:27.407948 | from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor
from typing import Dict
from typing import Union
import json_repair
import mdpd
import pandas as pd
from loguru import logger
from docext.core.client import sync_request
from docext.core.confidence import get_fields_confidence_score... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/core/config.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:27.424458 | from __future__ import annotations
TEMPLATES_FIELDS = {
"invoice colab demo 🧾": [
{"field_name": "invoice_number", "description": "Invoice number"},
{"field_name": "invoice_date", "description": "Invoice date"},
{"field_name": "invoice_amount", "description": "Invoice amount"},
{
... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/core/file_converters/file_converter.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:27.425643 | from __future__ import annotations
from abc import ABC
from abc import abstractmethod
class FileConverter(ABC):
@abstractmethod
def convert_to_images(self, file_path: str):
pass
|
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/core/pdf2md/pdf2md.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:27.982622 | from __future__ import annotations
import json
import os
from collections.abc import Generator
import requests
from loguru import logger
from docext.core.utils import convert_files_to_images
from docext.core.utils import encode_image
from docext.core.utils import resize_images
from docext.core.utils import validate_... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/core/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:28.011759 | from __future__ import annotations
import base64
import io
import os
from typing import Union
import pandas as pd
from PIL import Image
from docext.core.file_converters.pdf_converter import PDFConverter
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(imag... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/core/vllm.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:28.012346 | from __future__ import annotations
import os
import signal
import subprocess
import threading
import time
import requests
from loguru import logger
class VLLMServer:
def __init__(
self,
model_name: str,
host: str = "0.0.0.0",
port: int = 8000,
max_model_len: int = 15000,
... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/core/file_converters/pdf_converter.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:28.358411 | from __future__ import annotations
import os
import tempfile
from typing import Optional
from pdf2image import convert_from_path
from docext.core.file_converters.file_converter import FileConverter
class PDFConverter(FileConverter):
def convert_to_images(self, file_path: str):
return convert_from_path(... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | docext/core/prompts.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:28.760715 | from __future__ import annotations
import pandas as pd
from PIL import Image
from docext.core.utils import encode_image
def _get_name_desc_prompt(fields: list[str], fields_description: list[str]) -> str:
return "\n".join(
[
f"{field.replace(' ', '_').lower()}: {description}"
for ... |
NanoNets/docext | https://github.com/NanoNets/docext | null | null | null | null | 1,967 | null | null | apache-2.0 | null | null | null | null | null | null | null | setup.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:32.938185 | from __future__ import annotations
from setuptools import find_packages
from setuptools import setup
with open("requirements.txt") as f:
requirements = f.read().splitlines()
setup(
name="docext",
version="0.1.14",
author="Souvik Mandal",
author_email="souvik@nanonets.com",
description="Onprem... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/catapult_types.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:35.709374 | from hls4ml.backends.fpga.fpga_types import (
ArrayVariableConverter,
InplaceStreamVariableConverter,
StreamVariableConverter,
StructMemberVariableConverter,
VariableDefinition,
)
# region ArrayVariable
class CatapultArrayVariableDefinition(VariableDefinition):
def definition_cpp(self, name_s... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:35.711055 | from hls4ml.backends.backend import Backend, get_available_backends, get_backend, register_backend # noqa: F401
from hls4ml.backends.fpga.fpga_backend import FPGABackend # noqa: F401
from hls4ml.backends.libero.libero_backend import LiberoBackend
from hls4ml.backends.oneapi.oneapi_backend import OneAPIBackend
from hl... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/catapult_backend.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:35.712506 | import os
import sys
from warnings import warn
import numpy as np
from hls4ml.backends import FPGABackend
from hls4ml.backends.catapult.catapult_types import CatapultArrayVariableConverter
from hls4ml.backends.fpga.fpga_types import ACTypeConverter, HLSTypeConverter
from hls4ml.model.attributes import ChoiceAttribute... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/bn_quant.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:35.713798 | import numpy as np
from hls4ml.backends.fpga.fpga_layers import BatchNormalizationQuantizedTanh
from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.layers import BatchNormalization, register_layer
from hls4ml.model.optimizer import OptimizerPass
from hls4ml.model.types impo... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:35.719036 | from hls4ml import converters, report, utils # noqa: F401, E402
try:
from ._version import version as __version__
from ._version import version_tuple
except ImportError:
__version__ = 'unknown version'
version_tuple = (0, 0, 'unknown version')
def reseed(newseed):
print(f'\npytest-randomly: rese... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | docs/attr_doc_gen.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:35.720237 | import numbers
import hls4ml.backends as backends
import hls4ml.model.attributes as attributes
import hls4ml.model.layers as layers
class AttrList:
def __init__(self, cls_name, cls_attrs) -> None:
self.cls_name = cls_name
self.config_attrs = [attr for attr in cls_attrs if attr.configurable is Tru... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | docs/conf.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:35.723557 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/backend.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:35.753325 | import inspect
import os
from pathlib import Path
from hls4ml.backends.template import Template
from hls4ml.model.flow import get_backend_flows, update_flow
from hls4ml.model.optimizer import (
LayerOptimizerPass,
extract_optimizers_from_object,
extract_optimizers_from_path,
get_backend_passes,
get... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/broadcast_stream.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.296342 | import numpy as np
from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.layers import Concatenate, Layer, Merge, register_layer
from hls4ml.model.optimizer import OptimizerPass
class Broadcast(Layer):
"""Inserted between layers for broadcasting."""
def initialize(... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/core_templates.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.306172 | from hls4ml.backends.backend import get_backend
from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.layers import Activation, BatchNormalization, Dense, HardActivation, ParametrizedActivation, PReLU, Softmax
# Dense templates
dense_config_template = """struct config{index}... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/conv_same_pad.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.306996 | from hls4ml.model.layers import Conv1D, Conv2D, SeparableConv1D, SeparableConv2D
from hls4ml.model.optimizer import OptimizerPass
class InsertZeroPaddingBeforeConv1D(OptimizerPass):
name = 'insert_zero_padding_before_conv1d'
def match(self, node):
is_match = isinstance(node, (Conv1D, SeparableConv1D)... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/convolution_winograd.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.326083 | import math
import numpy as np
from hls4ml.model.layers import Conv1D, Conv2D
from hls4ml.model.optimizer import OptimizerPass
class ApplyWinogradKernelTransformation(OptimizerPass):
"""
Transforms the weights of a Conv2D kernel to a format suitable for Wingorad convolution
For further information, refe... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/conv_stream.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.329281 | from hls4ml.model.layers import Conv1D, Conv2D, SeparableConv1D, SeparableConv2D
from hls4ml.model.optimizer import OptimizerPass
class GenerateConvStreamingInstructions(OptimizerPass):
"""Generates the instructions for streaming implementation of CNNs"""
def match(self, node):
is_match = (
... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/garnet_templates.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.336310 | import numpy as np
from hls4ml.backends.fpga.fpga_types import ACTypeConverter
from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.layers import GarNet, GarNetStack
from hls4ml.model.types import FixedPrecisionType
# GarNet templates
garnet_common_config_template = """
... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/im2col_codegen.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.342223 | from hls4ml.model.layers import Conv1D, Conv2D, SeparableConv1D, SeparableConv2D
from hls4ml.model.optimizer import OptimizerPass
from hls4ml.model.types import Source
class GenerateConvIm2col(OptimizerPass):
"""Generates tcode for im2col step of 1D/2d convolution"""
# Note, DepthwizeConv1D/2D also matches b... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/fifo_depth_optimization.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.392850 | import json
from pyDigitalWaveTools.vcd.parser import VcdParser
from hls4ml.model.optimizer.optimizer import ConfigurableOptimizerPass, ModelOptimizerPass
def populate_values(values, name, data, depth):
def get_values(x):
return int(x[1][1:], 2)
values.append({'name': name, 'data': [], 'max': 0, 'd... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/convolution_templates.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.394083 | from hls4ml.backends.backend import get_backend
from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.layers import (
Conv1D,
Conv2D,
Conv2DBatchnorm,
DepthwiseConv1D,
DepthwiseConv2D,
SeparableConv1D,
SeparableConv2D,
)
# Shared multiplication tem... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/merge_templates.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.402164 | from hls4ml.backends.backend import get_backend
from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.layers import Concatenate, Dot, Merge
# Merge templates
merge_config_template = """struct config{index} : nnet::merge_config {{
static const unsigned n_elem = {n_elem};
... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/resource_strategy.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.930234 | import numpy as np
from hls4ml.model.layers import GRU, LSTM, Conv1D, Conv2D, Dense, SeparableConv1D, SeparableConv2D
from hls4ml.model.optimizer import OptimizerPass
class ApplyResourceStrategy(OptimizerPass):
"""Transposes the weights to use the dense_resource matrix multiply routine"""
def match(self, no... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/pointwise.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.931289 | from hls4ml.backends.catapult.passes.convolution_templates import (
Conv1DConfigTemplate,
Conv1DFunctionTemplate,
Conv2DConfigTemplate,
Conv2DFunctionTemplate,
conv1d_config_template,
conv2d_config_template,
conv_mult_config_template,
)
from hls4ml.backends.fpga.fpga_layers import PointwiseC... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/transform_types.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.932449 | from hls4ml.backends.catapult.catapult_types import (
CatapultArrayVariableConverter,
CatapultInplaceArrayVariableConverter,
CatapultInplaceStreamVariableConverter,
CatapultStreamVariableConverter,
)
from hls4ml.backends.fpga.fpga_types import ACTypeConverter, HLSTypeConverter, StaticWeightVariableConve... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/pooling_templates.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.935801 | from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.layers import GlobalPooling1D, GlobalPooling2D, Pooling1D, Pooling2D
# Pooling templates
pooling1d_config_template = """struct config{index} : nnet::pooling1d_config {{
static const unsigned n_in = {n_in};
static ... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/reshaping_templates.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:36.936822 | from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.layers import Resize, Transpose, ZeroPadding1D, ZeroPadding2D
# ZeroPadding templates
zeropad1d_config_template = """struct config{index} : nnet::padding1d_config {{
static const unsigned in_width = {in_width};
st... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/quantization_templates.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.024904 | from hls4ml.backends.backend import get_backend
from hls4ml.backends.catapult.passes.core_templates import (
batchnorm_config_template,
batchnorm_function_template,
batchnorm_include_list,
)
from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.optimizer.passes.qke... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/catapult/passes/recurrent_templates.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.026652 | from hls4ml.backends.backend import get_backend
from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.layers import GRU, LSTM
# recurrent multiplication template
recr_mult_config_template = """struct config{index} : nnet::dense_config {{
static const unsigned n_in = {n_i... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/fpga_layers.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.037849 | import numpy as np
from hls4ml.model.attributes import Attribute, ConfigurableAttribute, TypeAttribute
from hls4ml.model.layers import Conv1D, Conv2D, Layer
from hls4ml.model.types import IntegerPrecisionType, XnorPrecisionType
class BatchNormalizationQuantizedTanh(Layer):
"""Merged Batch Normalization and quant... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/fpga_backend.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.039121 | import math
import re
import subprocess
from bisect import bisect_left
from collections.abc import Iterable
import numpy as np
from hls4ml.backends.backend import Backend
from hls4ml.model.attributes import Attribute, ChoiceAttribute, ConfigurableAttribute, TypeAttribute
from hls4ml.model.layers import (
GRU,
... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/passes/clone.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.508376 | from math import prod
from hls4ml.backends.template import FunctionCallTemplate
from hls4ml.model.layers import Layer, register_layer
from hls4ml.model.optimizer import OptimizerPass
class Clone(Layer):
"""Inserted after the layer whose output is used more than once."""
def initialize(self):
inp = s... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/passes/bram_weights.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.508976 | import numpy as np
from hls4ml.backends.fpga.fpga_types import BramWeightVariableConverter
from hls4ml.model.optimizer import OptimizerPass
class RegisterBramWeights(OptimizerPass):
def match(self, node):
return len(node.weights) > 0
def transform(self, model, node):
bramport_size = model.co... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/passes/inplace_parallel_reshape.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.645416 | from hls4ml.model.layers import Reshape
from hls4ml.model.optimizer import OptimizerPass
from hls4ml.model.types import InplaceTensorVariable
class InplaceParallelReshape(OptimizerPass):
"""
Replaces the output variable of Reshape layer with an inplace variable when using io_parallel.
This is done becaus... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/passes/hgq_proxy_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.646338 | import numpy as np
from hls4ml.backends import Backend
from hls4ml.backends.template import FunctionCallTemplate
from hls4ml.model.layers import Layer
from hls4ml.model.optimizer import OptimizerPass
from hls4ml.model.optimizer.passes.hgq_proxy_model import FixedPointQuantizer, UnaryLUT
from hls4ml.model.types import ... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/passes/embedding.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.668340 | from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.layers import Embedding
embed_config_template = """struct config{index} : nnet::embed_config {{
static const unsigned n_in = {n_in};
static const unsigned n_out = {n_out};
static const unsigned vocab_size = {vo... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/passes/inplace_stream_flatten.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.669865 | from hls4ml.model.layers import Reshape
from hls4ml.model.optimizer import OptimizerPass
from hls4ml.model.types import InplaceTensorVariable
class InplaceStreamFlatten(OptimizerPass):
"""
Replaces the output variable of Reshape (flatten) layer with an inplace variable when using io_stream.
This optimize... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/passes/final_reshape.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.671354 | from hls4ml.model.layers import Reshape
from hls4ml.model.optimizer import OptimizerPass
class RemoveFinalReshape(OptimizerPass):
"""Remove reshape if final layer"""
def match(self, node):
# match if reshape is final node
return isinstance(node, Reshape) and not node.get_output_nodes()
d... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/passes/fix_softmax_table_size.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.672466 | import warnings
from hls4ml.model.layers import Layer, Softmax
from hls4ml.model.optimizer import OptimizerPass
class FixSoftmaxTableSize(OptimizerPass):
def match(self, node):
if not isinstance(node, Softmax):
return False
if 'inv_table_size' in node.attributes:
return Fa... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/fpga_types.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:37.750269 | import numpy as np
from hls4ml.model.types import (
CompressedType,
ExponentPrecisionType,
ExponentType,
FixedPrecisionType,
FloatPrecisionType,
IntegerPrecisionType,
NamedType,
PackedType,
StandardFloatPrecisionType,
XnorPrecisionType,
)
# region Precision types
class Precis... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/passes/repack_stream.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:38.102494 | import numpy as np
from hls4ml.backends.template import FunctionCallTemplate
from hls4ml.model.layers import Layer, Reshape, register_layer
from hls4ml.model.optimizer import OptimizerPass
class Repack(Layer):
"""Inserted between layers with different packing factors."""
def initialize(self):
shape ... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/passes/remove_softmax.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:38.213285 | from hls4ml.model.layers import Softmax
from hls4ml.model.optimizer.optimizer import OptimizerPass
class SkipSoftmax(OptimizerPass):
def match(self, node):
is_softmax = isinstance(node, Softmax)
remove_softmax = node.get_attr('skip', False)
return is_softmax and remove_softmax
def tra... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/fpga/passes/xnor_pooling.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:38.276687 | from hls4ml.model.layers import GlobalPooling1D, GlobalPooling2D, Pooling1D, Pooling2D
from hls4ml.model.optimizer import OptimizerPass
from hls4ml.model.types import XnorPrecisionType
class XnorPooling(OptimizerPass):
"""
For correct behavior, for MaxPooling and similar, for XnorPrecisionType, have to propag... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/libero/libero_backend.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:38.297924 | import os
import subprocess
import sys
from pathlib import Path
from hls4ml.backends import FPGABackend
from hls4ml.model.attributes import ChoiceAttribute
from hls4ml.model.flow import register_flow
from hls4ml.model.layers import Dense, Layer
from hls4ml.model.optimizer import layer_optimizer
from hls4ml.model.types... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/libero/passes/transform_types.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:38.380662 | from hls4ml.backends.fpga.fpga_types import HLSTypeConverter, StaticWeightVariableConverter
from hls4ml.backends.libero.libero_types import (
LAPTypeConverter,
LiberoArrayVariableConverter,
LiberoInplaceArrayVariableConverter,
LiberoInplaceStreamVariableConverter,
LiberoStreamVariableConverter,
... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/libero/passes/core_templates.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:38.386679 | from hls4ml.backends.backend import get_backend
from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
from hls4ml.model.layers import Activation, BatchNormalization, Dense
# Dense templates
dense_config_template = """struct config{index} : nnet::dense_config {{
static const unsigned n_in ... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/libero/libero_types.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:38.387298 | from hls4ml.backends.fpga.fpga_types import (
ArrayVariableConverter,
ExponentPrecisionType,
FixedPrecisionType,
FPGAPrecisionConverter,
InplaceStreamVariableConverter,
IntegerPrecisionType,
PrecisionDefinition,
StreamVariableConverter,
VariableDefinition,
XnorPrecisionType,
)
#... |
fastmachinelearning/hls4ml | https://github.com/fastmachinelearning/hls4ml | null | null | null | null | 1,964 | null | null | apache-2.0 | null | null | null | null | null | null | null | hls4ml/backends/libero/passes/pipeline_style.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:38.388253 | from hls4ml.model.layers import Conv1D, Conv2D
from hls4ml.model.optimizer import ModelOptimizerPass
class SetPipelineStyle(ModelOptimizerPass):
def __init__(self):
pass
def transform(self, model):
if model.config.pipeline_style not in ['auto', 'pipeline', 'dataflow']:
print(
... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/azuredataexplorer.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:41.388214 | """Helpers to create Azure Data Explorer specific Grafana queries."""
import attr
TIME_SERIES_RESULT_FORMAT = 'time_series'
TABLE_RESULT_FORMAT = 'table'
ADX_TIME_SERIES_RESULT_FORMAT = 'time_series_adx_series'
@attr.s
class AzureDataExplorerTarget(object):
"""
Generates Azure Data Explorer target JSON stru... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/cloudwatch.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:41.389389 | """Helpers to create Cloudwatch-specific Grafana queries."""
import attr
from attr.validators import instance_of
from grafanalib.core import Target
@attr.s
class CloudwatchMetricsTarget(Target):
"""
Generates Cloudwatch target JSON structure.
Grafana docs on using Cloudwatch:
https://grafana.com/do... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/formatunits.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:41.390645 | """
Grafana unit formats
(https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/valueFormats/categories.ts)
To use:
from grafanalib import formatunits as UNITS
format = UNITS.BYTES
"""
NO_FORMAT = 'none'
NONE_FORMAT = 'none'
NUMBER_FORMAT = 'none'
STRING_FORMAT = 'string'
PERCENT_UNIT = 'percentunit... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/humio.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:41.391906 | """Helpers to create Humio-specific Grafana queries."""
import attr
@attr.s
class HumioTarget(object):
"""
Generates Humio target JSON structure.
Link to Humio Grafana plugin https://grafana.com/grafana/plugins/humio-datasource/
Humio docs on query language https://library.humio.com/humio-server/sy... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/azuremonitor.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:41.394415 | """Helpers to create Azure Monitor specific Grafana queries."""
import attr
from attr.validators import instance_of
@attr.s
class AzureMonitorMetricsTarget(object):
"""
Generates Azure Monitor Metrics target JSON structure.
Grafana docs on using Azure Monitor:
https://grafana.com/docs/grafana/latest... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/_gen.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:41.395503 | """Generate JSON Grafana dashboards."""
import argparse
import json
import os
import sys
DASHBOARD_SUFFIX = '.dashboard.py'
ALERTGROUP_SUFFIX = '.alertgroup.py'
"""
Common generation functionality
"""
class DashboardEncoder(json.JSONEncoder):
"""Encode dashboard objects."""
def default(self, obj):
... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/influxdb.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:41.396516 | """Helpers to create InfluxDB-specific Grafana queries."""
import attr
TIME_SERIES_TARGET_FORMAT = 'time_series'
@attr.s
class InfluxDBTarget(object):
"""
Generates InfluxDB target JSON structure.
Grafana docs on using InfluxDB:
https://grafana.com/docs/features/datasources/influxdb/
InfluxDB d... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | docs/conf.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:41.397670 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/elasticsearch.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:41.398657 | """Helpers to create Elasticsearch-specific Grafana queries."""
import attr
import itertools
from attr.validators import in_, instance_of
from grafanalib.core import AlertCondition
DATE_HISTOGRAM_DEFAULT_FIELD = 'time_iso8601'
ORDER_ASC = 'asc'
ORDER_DESC = 'desc'
@attr.s
class CountMetricAgg(object):
"""An agg... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/tests/examples/example.upload-alerts.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:42.382501 | from grafanalib.core import AlertGroup
from grafanalib._gen import DashboardEncoder, loader
import json
import requests
from os import getenv
def get_alert_json(alert: AlertGroup):
'''
get_alert_json generates JSON from grafanalib AlertGroup object
:param alert - AlertGroup created via grafanalib
'''... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/tests/examples/table-example-dashboard.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:43.230667 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
NAME:
table-example-dashboard.py
DESCRIPTION:
This script creates Grafana dashboards using Grafanalib, and a static table
which defines metrics/dashboards.
The resulting dashboard can be easily uploaded to Grafana with associated script:
upl... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/tests/examples/example.upload-dashboard.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:43.434883 | from grafanalib.core import Dashboard
from grafanalib._gen import DashboardEncoder
import json
import requests
from os import getenv
def get_dashboard_json(dashboard, overwrite=False, message="Updated by grafanlib"):
'''
get_dashboard_json generates JSON from grafanalib Dashboard object
:param dashboard ... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/tests/test_azuredataexplorer.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:44.019151 | import grafanalib.core as G
import grafanalib.azuredataexplorer as A
from grafanalib import _gen
from io import StringIO
def test_serialization_azuredataexplorer_metrics_target():
"""Serializing a graph doesn't explode."""
graph = G.Graph(
title="Azure Data Explorer graph",
dataSource="default... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/tests/test_azuremonitor.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:44.245340 | """Tests for Azure Monitor Datasource"""
import grafanalib.core as G
import grafanalib.azuremonitor as A
from grafanalib import _gen
from io import StringIO
def test_serialization_azure_metrics_target():
"""Serializing a graph doesn't explode."""
graph = G.TimeSeries(
title="Test Azure Monitor",
... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/tests/test_cloudwatch.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:44.658135 | """Tests for Cloudwatch Datasource"""
import grafanalib.core as G
import grafanalib.cloudwatch as C
from grafanalib import _gen
from io import StringIO
def test_serialization_cloudwatch_metrics_target():
"""Serializing a graph doesn't explode."""
graph = G.Graph(
title="Lambda Duration",
data... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/tests/test_core.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:44.872224 | """Tests for core."""
import random
import grafanalib.core as G
import pytest
def dummy_grid_pos() -> G.GridPos:
return G.GridPos(h=1, w=2, x=3, y=4)
def dummy_data_link() -> G.DataLink:
return G.DataLink(
title='dummy title',
linkUrl='https://www.dummy-link-url.com',
isNewTab=True
... |
weaveworks/grafanalib | https://github.com/weaveworks/grafanalib | null | null | null | null | 1,961 | null | null | apache-2.0 | null | null | null | null | null | null | null | grafanalib/tests/test_elasticsearch.py | null | null | null | null | null | null | Python | 2026-05-04T02:44:45.473353 | """Tests for elasticsearch."""
import grafanalib.elasticsearch as E
import pytest
def test_rate_metric_agg():
t = E.RateMetricAgg()
json_data = t.to_json_data()
assert json_data["id"] == "0"
assert json_data["hide"] is False
assert json_data["field"] == ""
assert len(json_data["settings"]) =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.