repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/sync_batchnorm/batchnorm.py
sync_batchnorm/batchnorm.py
# -*- coding: utf-8 -*- # File : batchnorm.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import collections import torch import torc...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/TFHub/converter.py
TFHub/converter.py
"""Utilities for converting TFHub BigGAN generator weights to PyTorch. Recommended usage: To convert all BigGAN variants and generate test samples, use: ```bash CUDA_VISIBLE_DEVICES=0 python converter.py --generate_samples ``` See `parse_args` for additional options. """ import argparse import os import sys impor...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
yaxingwang/MineGAN
https://github.com/yaxingwang/MineGAN/blob/a810f2d77f36ea9cf6993dede958b6f5d458f4b6/TFHub/biggan_v1.py
TFHub/biggan_v1.py
# BigGAN V1: # This is now deprecated code used for porting the TFHub modules to pytorch, # included here for reference only. import numpy as np import torch from scipy.stats import truncnorm from torch import nn from torch.nn import Parameter from torch.nn import functional as F def l2normalize(v, eps=1e-4): retur...
python
MIT
a810f2d77f36ea9cf6993dede958b6f5d458f4b6
2026-01-05T07:08:28.063149Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/setup.py
setup.py
from setuptools import setup requirements = ["scikit-allel", "pandas", "numpy", "multiprocess", "scipy", "numcodecs", "typing-extensions"] setup( name="pixy", version="2.0.0.beta14", packages=["pixy"], entry_points={"console_scripts": ["pixy=pixy.__main__:main"]}, url="https://github.com/ksamuk/pi...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/pixy/enums.py
pixy/enums.py
from enum import Enum from enum import unique @unique class PixyStat(Enum): """ The genetic variance statistics that `pixy` can calculate. Attributes: PI: a measure of genetic diversity _within_ populations DXY: a measure of genetic diversity _between_ populations FST: the "fixati...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/pixy/models.py
pixy/models.py
from dataclasses import dataclass from dataclasses import fields from typing import Literal from typing import Union from typing_extensions import TypeAlias from pixy.args_validation import PixyStat NA: TypeAlias = Literal["NA"] @dataclass(frozen=True) class PixyTempResult: """ Stores temporary `pixy` resu...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/pixy/core.py
pixy/core.py
import argparse import logging import os import shutil import subprocess import uuid from pathlib import Path from typing import Dict from typing import List from typing import Literal from typing import Optional from typing import Set from typing import Tuple from typing import Union import allel import multiprocess ...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
true
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/pixy/__main__.py
pixy/__main__.py
#!/usr/bin/env python # coding: utf-8 import argparse import logging import os import re import subprocess import sys import time from multiprocessing.context import BaseContext from multiprocessing.managers import SyncManager from multiprocessing.pool import ApplyResult from typing import List from typing import Optio...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
true
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/pixy/args_validation.py
pixy/args_validation.py
import argparse import gzip import logging import os import shutil import subprocess import uuid from dataclasses import dataclass from functools import cached_property from pathlib import Path from typing import List from typing import Tuple from typing import Union import allel import multiprocess as mp import numpy...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/pixy/calc.py
pixy/calc.py
from collections import Counter from typing import Any from typing import Counter as CounterType from typing import List from typing import Tuple from typing import Union import allel import numpy as np from allel import AlleleCountsArray from allel import GenotypeArray from numpy.typing import NDArray from scipy impo...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/pixy/__init__.py
pixy/__init__.py
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/pixy/stats/summary.py
pixy/stats/summary.py
"""Compute summary statistics.""" import argparse from itertools import combinations from typing import Dict from typing import List from typing import Tuple from typing import Union from typing import cast import numpy as np from allel import AlleleCountsArray from allel import GenotypeArray from allel import Genoty...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/pixy/stats/__init__.py
pixy/stats/__init__.py
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/tests/test_calc.py
tests/test_calc.py
import allel import numpy as np import pytest from allel import AlleleCountsArray from allel import GenotypeArray from allel import hudson_fst from allel import mean_pairwise_difference from allel import mean_pairwise_difference_between from allel import watterson_theta from allel import weir_cockerham_fst from pixy.c...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
true
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/tests/conftest.py
tests/conftest.py
import sys from pathlib import Path from typing import List from typing import Optional from unittest.mock import patch import pandas as pd import pytest from pixy.__main__ import main ################################################################################ # Fixtures for testing input + output locations ###...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/tests/__init__.py
tests/__init__.py
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/tests/stats/test_models.py
tests/stats/test_models.py
from typing import Union import pytest from pixy.args_validation import PixyStat from pixy.models import NA from pixy.models import PixyTempResult @pytest.mark.parametrize( "pixy_stat, pop1, pop2, chr, pos_1, pos_2, calculated_stat, shared, diffs, comps, missing," "expected_str", [ ( ...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/tests/main/test_main.py
tests/main/test_main.py
import logging import os import shutil from pathlib import Path from typing import List from typing import Optional from unittest.mock import patch import pytest from tests.conftest import assert_files_are_consistent from tests.conftest import run_pixy_helper #########################################################...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/tests/args_validation/test_args_validation.py
tests/args_validation/test_args_validation.py
import argparse from pathlib import Path import pytest from pixy.args_validation import PixyArgs from pixy.args_validation import check_and_validate_args @pytest.mark.parametrize("bypass_variant_check", [True, False]) def test_check_and_validate_args( ag1000_vcf_path: Path, ag1000_pop_path: Path, bypass...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
ksamuk/pixy
https://github.com/ksamuk/pixy/blob/7ceab4530d2bfbaea6e7fab4fb782e64b2d83156/docs/conf.py
docs/conf.py
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
python
MIT
7ceab4530d2bfbaea6e7fab4fb782e64b2d83156
2026-01-05T07:08:43.851194Z
false
AIAnytime/Document-Buddy-App
https://github.com/AIAnytime/Document-Buddy-App/blob/c34bd80fb7f83ab3b28365ffe320a750f19caa96/vectors.py
vectors.py
import os from langchain_community.document_loaders import UnstructuredPDFLoader from langchain_text_splitters import RecursiveCharacterTextSplitter from langchain_community.embeddings import HuggingFaceEmbeddings from langchain_community.vectorstores import Qdrant import streamlit as st class EmbeddingsManager: d...
python
MIT
c34bd80fb7f83ab3b28365ffe320a750f19caa96
2026-01-05T07:08:49.962939Z
false
AIAnytime/Document-Buddy-App
https://github.com/AIAnytime/Document-Buddy-App/blob/c34bd80fb7f83ab3b28365ffe320a750f19caa96/chatbot.py
chatbot.py
# chatbot.py import os from langchain_community.embeddings import HuggingFaceBgeEmbeddings from langchain_community.vectorstores import Qdrant from langchain_ollama import ChatOllama from qdrant_client import QdrantClient from langchain import PromptTemplate from langchain.chains import RetrievalQA import streamlit as...
python
MIT
c34bd80fb7f83ab3b28365ffe320a750f19caa96
2026-01-05T07:08:49.962939Z
false
AIAnytime/Document-Buddy-App
https://github.com/AIAnytime/Document-Buddy-App/blob/c34bd80fb7f83ab3b28365ffe320a750f19caa96/new.py
new.py
# app.py import streamlit as st from streamlit import session_state import time import base64 import os from vectors import EmbeddingsManager # Import the EmbeddingsManager class from chatbot import ChatbotManager # Import the ChatbotManager class # Function to display the PDF of a given file def displayPDF(file...
python
MIT
c34bd80fb7f83ab3b28365ffe320a750f19caa96
2026-01-05T07:08:49.962939Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/export_onnx.py
model_convert/export_onnx.py
# Copyright (c) 2021 Binbin Zhang(binbzha@qq.com) # Copyright (c) 2024 Yang Chen (cyang8050@163.com) # # 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/LIC...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/model/subsampling.py
model_convert/model/subsampling.py
# Copyright (c) 2021 Binbin Zhang # # 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/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/model/mdtc.py
model_convert/model/mdtc.py
#!/usr/bin/env python3 # Copyright (c) 2021 Jingyong Hou (houjingyong@gmail.com) # # 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/LICENSE-2.0 # # Unless re...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/model/tcn.py
model_convert/model/tcn.py
#!/usr/bin/env python3 # Copyright (c) 2021 Binbin Zhang # # 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/LICENSE-2.0 # # Unless required by applicable law...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/model/kws_model.py
model_convert/model/kws_model.py
# Copyright (c) 2021 Binbin Zhang # 2023 Jing Du # # 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/LICENSE-2.0 # # Unless required by applic...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/model/cmvn.py
model_convert/model/cmvn.py
#!/usr/bin/env python3 # Copyright (c) 2020 Binbin Zhang # # 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/LICENSE-2.0 # # Unless required by applicable law...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/model/loss.py
model_convert/model/loss.py
# Copyright (c) 2021 Binbin Zhang # 2023 Jing Du # # 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/LICENSE-2.0 # # Unless required by applic...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/model/classifier.py
model_convert/model/classifier.py
# Copyright (c) 2021 Jingyong Hou # # 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/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/model/fsmn.py
model_convert/model/fsmn.py
''' FSMN implementation. Copyright: 2022-03-09 yueyue.nyy 2023 Jing Du ''' from typing import Tuple import numpy as np import torch import torch.nn as nn import torch.nn.functional as F def toKaldiMatrix(np_mat): np.set_printoptions(threshold=np.inf, linewidth=np.nan) out_str = str(np_mat)...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/utils/file_utils.py
model_convert/utils/file_utils.py
# Copyright (c) 2021 Mobvoi Inc. (authors: Binbin Zhang) # # 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/LICENSE-2.0 # # Unless required by applicable l...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/utils/train_utils.py
model_convert/utils/train_utils.py
#!/usr/bin/env python3 # Copyright (c) 2021 Jingyong Hou (houjingyong@gmail.com) # # 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/LICENSE-2.0 # # Unless re...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/utils/executor.py
model_convert/utils/executor.py
# Copyright (c) 2021 Binbin Zhang # # 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/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/utils/checkpoint.py
model_convert/utils/checkpoint.py
# Copyright (c) 2021 Binbin Zhang # # 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/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/utils/mask.py
model_convert/utils/mask.py
# Copyright (c) 2021 Binbin Zhang # # 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/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
chenyangMl/keyword-spot
https://github.com/chenyangMl/keyword-spot/blob/269d3853ea4d84dfba391a2aec2bf51e0e396d0a/model_convert/utils/cmvn.py
model_convert/utils/cmvn.py
#!/usr/bin/env python3 # Copyright (c) 2020 Binbin Zhang # # 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/LICENSE-2.0 # # Unless required by applicable law...
python
MIT
269d3853ea4d84dfba391a2aec2bf51e0e396d0a
2026-01-05T07:08:50.083450Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/setup.py
model/parler-tts/setup.py
# Copyright 2024 The HuggingFace 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/LICENSE-2.0 # # Unless required by applicabl...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/helpers/gradio_demo/app.py
model/parler-tts/helpers/gradio_demo/app.py
import gradio as gr import torch from transformers import AutoFeatureExtractor, AutoTokenizer, set_seed from parler_tts import ParlerTTSForConditionalGeneration device = "cuda:0" if torch.cuda.is_available() else "cpu" repo_id = "parler-tts/parler_tts_mini_v0.1" model = ParlerTTSForConditionalGeneration.from_pretr...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/helpers/model_init_scripts/init_large_model.py
model/parler-tts/helpers/model_init_scripts/init_large_model.py
from parler_tts import ParlerTTSForCausalLM, ParlerTTSForConditionalGeneration, ParlerTTSDecoderConfig from transformers import AutoConfig import os import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("save_directory", type=str, help="Directory where to save the m...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/helpers/model_init_scripts/init_dummy_model.py
model/parler-tts/helpers/model_init_scripts/init_dummy_model.py
import argparse import os from transformers import AutoConfig from parler_tts import ParlerTTSDecoderConfig, ParlerTTSForCausalLM, ParlerTTSForConditionalGeneration if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("save_directory", type=str, help="Directory where to save the...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/helpers/model_init_scripts/init_dummy_model_with_encodec.py
model/parler-tts/helpers/model_init_scripts/init_dummy_model_with_encodec.py
import argparse import os from transformers import AutoConfig from parler_tts import ParlerTTSDecoderConfig, ParlerTTSForCausalLM, ParlerTTSForConditionalGeneration if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("save_directory", type=str, help="Directory where to save the...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/helpers/model_init_scripts/init_model_600M.py
model/parler-tts/helpers/model_init_scripts/init_model_600M.py
import argparse import os from transformers import AutoConfig from parler_tts import ParlerTTSDecoderConfig, ParlerTTSForCausalLM, ParlerTTSForConditionalGeneration if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("save_directory", type=str, help="Directory where to save the...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/helpers/push_to_hub_scripts/push_trained_parler_tts_to_hub.py
model/parler-tts/helpers/push_to_hub_scripts/push_trained_parler_tts_to_hub.py
from transformers import AutoFeatureExtractor, AutoTokenizer from parler_tts import ParlerTTSForConditionalGeneration path = "TODO" repo_id = "parler_tts_600M" AutoFeatureExtractor.from_pretrained("ylacombe/dac_44khZ_8kbps").push_to_hub(repo_id) AutoTokenizer.from_pretrained("google/t5-v1_1-base").push_to_hub(repo...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/helpers/push_to_hub_scripts/push_dac_to_hub.py
model/parler-tts/helpers/push_to_hub_scripts/push_dac_to_hub.py
import dac from transformers import AutoConfig, AutoModel, EncodecFeatureExtractor from parler_tts import DACConfig, DACModel from transformers import AutoConfig, AutoModel from transformers import EncodecFeatureExtractor from importlib.metadata import version from packaging.version import Version if Version(version...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/parler_tts/configuration_parler_tts.py
model/parler-tts/parler_tts/configuration_parler_tts.py
# coding=utf-8 # Copyright 2024 and 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/LICENSE-2.0 # # Unle...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/parler_tts/logits_processors.py
model/parler-tts/parler_tts/logits_processors.py
from transformers import LogitsProcessor, LogitsProcessorList from transformers.pytorch_utils import isin_mps_friendly import math import torch class ParlerTTSLogitsProcessor(LogitsProcessor): r"""This processor ensures that the delayed pattern mask constraints are respected. <Tip warning={true}> This lo...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/parler_tts/__init__.py
model/parler-tts/parler_tts/__init__.py
__version__ = "0.2.2" from transformers import AutoConfig, AutoModel from .configuration_parler_tts import ParlerTTSConfig, ParlerTTSDecoderConfig from .dac_wrapper import DACConfig, DACModel from .modeling_parler_tts import ( ParlerTTSForCausalLM, ParlerTTSForConditionalGeneration, apply_delay_pattern_m...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/parler_tts/modeling_parler_tts.py
model/parler-tts/parler_tts/modeling_parler_tts.py
# coding=utf-8 # Copyright 2024 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/LICENSE-2.0 # # Unless r...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
true
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/parler_tts/streamer.py
model/parler-tts/parler_tts/streamer.py
from .modeling_parler_tts import ParlerTTSForConditionalGeneration from transformers.generation.streamers import BaseStreamer from typing import Optional import torch import numpy as np import math from queue import Queue class ParlerTTSStreamer(BaseStreamer): def __init__( self, model: ParlerTTS...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/parler_tts/dac_wrapper/configuration_dac.py
model/parler-tts/parler_tts/dac_wrapper/configuration_dac.py
from transformers import PretrainedConfig from importlib.metadata import version from packaging.version import Version class DACConfig(PretrainedConfig): model_type = "dac" if Version(version("transformers"))<= Version("4.44.2dev") else "dac_on_the_hub" def __init__( self, num_codebooks: int...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/parler_tts/dac_wrapper/modeling_dac.py
model/parler-tts/parler_tts/dac_wrapper/modeling_dac.py
import torch from dac.model import DAC from torch import nn from transformers import PreTrainedModel from transformers.models.encodec.modeling_encodec import EncodecDecoderOutput, EncodecEncoderOutput from .configuration_dac import DACConfig # model doesn't support batching yet class DACModel(PreTrainedModel): ...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/parler_tts/dac_wrapper/__init__.py
model/parler-tts/parler_tts/dac_wrapper/__init__.py
from .configuration_dac import DACConfig from .modeling_dac import DACModel
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/training/eval.py
model/parler-tts/training/eval.py
import torch from torchaudio.pipelines import SQUIM_OBJECTIVE import torchaudio import evaluate from transformers import ( AutoModel, AutoProcessor, pipeline, WhisperForConditionalGeneration, WhisperTokenizer, WhisperTokenizerFast, ) from accelerate.utils.memory import release_memory import nump...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/training/arguments.py
model/parler-tts/training/arguments.py
from dataclasses import dataclass, field from typing import Optional, List from transformers import Seq2SeqTrainingArguments @dataclass class ModelArguments: """ Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. """ model_name_or_path: str = field( metadata...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/training/utils.py
model/parler-tts/training/utils.py
import os import re import shutil from dataclasses import field from pathlib import Path from typing import Dict, List import torch from datasets import concatenate_datasets, load_from_disk from wandb import Audio from datasets import load_from_disk, concatenate_datasets def list_field(default=None, metadata=None): ...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/training/run_parler_tts_training.py
model/parler-tts/training/run_parler_tts_training.py
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 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...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
true
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/training/__init__.py
model/parler-tts/training/__init__.py
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/parler-tts/training/data.py
model/parler-tts/training/data.py
import logging from dataclasses import dataclass from typing import Dict, List, Optional, Set, Union import datasets import numpy as np import torch from accelerate import Accelerator from datasets import Dataset, IterableDataset, concatenate_datasets, interleave_datasets, load_dataset from tqdm import tqdm from trans...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/inference/run_inference.py
model/inference/run_inference.py
import argparse import torch from parler_tts import ParlerTTSForConditionalGeneration from transformers import AutoTokenizer, pipeline, WhisperForConditionalGeneration, WhisperTokenizer, WhisperTokenizerFast import soundfile as sf import evaluate def wer(asr_pipeline, prompt, audio, sampling_rate): """ Calcula...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/model/inference/run_inference_gradio_app.py
model/inference/run_inference_gradio_app.py
import gradio as gr import torch from parler_tts import ParlerTTSForConditionalGeneration from transformers import AutoTokenizer, pipeline, WhisperForConditionalGeneration, WhisperTokenizer, WhisperTokenizerFast import numpy as np import evaluate # Example prompts from the paper (only style and text) EXAMPLES = [ ...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/dataset/audio_preprocessing/apply_expresso_vad.py
dataset/audio_preprocessing/apply_expresso_vad.py
import argparse from pathlib import Path import pydub import sys def load_vad_segments(vad_file): """Load VAD segments from file into a nested dictionary.""" vad_segments = {} # {filename: {channel: [(start, end)]}} with open(vad_file, 'r') as f: for line in f: line = line.strip()...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/dataset/audio_preprocessing/add_real_audio_paths.py
dataset/audio_preprocessing/add_real_audio_paths.py
import argparse from pathlib import Path from datasets import load_dataset def add_audio_paths(example, source_to_root, validate_exists=False): """Adds real audio path to a single example.""" source = example["source"] if source not in source_to_root: raise ValueError(f"Unknown source dataset: {sou...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
ajd12342/paraspeechcaps
https://github.com/ajd12342/paraspeechcaps/blob/9a5e98892fbae54fcc6b56dc3bb755af5ca47601/dataset/audio_preprocessing/apply_voicefixer.py
dataset/audio_preprocessing/apply_voicefixer.py
import voicefixer from pathlib import Path import sys from pydub import AudioSegment, effects import argparse def apply_voicefixer(model, input_audio_path, output_audio_path): """Apply voicefixer to a single audio file and normalize the output.""" if output_audio_path.exists(): return model.re...
python
MIT
9a5e98892fbae54fcc6b56dc3bb755af5ca47601
2026-01-05T07:08:54.013665Z
false
DadaNanjesha/AI-Text-Humanizer-App
https://github.com/DadaNanjesha/AI-Text-Humanizer-App/blob/eeea9f13805d21a91071beae0f1403fcfe9165b1/main.py
main.py
import streamlit as st from transformer.app import AcademicTextHumanizer, NLP_GLOBAL, download_nltk_resources from nltk.tokenize import word_tokenize import difflib def main(): """ The `main` function sets up a Streamlit page for transforming user-provided text into a more formal academic style by expand...
python
MIT
eeea9f13805d21a91071beae0f1403fcfe9165b1
2026-01-05T07:08:59.727233Z
false
DadaNanjesha/AI-Text-Humanizer-App
https://github.com/DadaNanjesha/AI-Text-Humanizer-App/blob/eeea9f13805d21a91071beae0f1403fcfe9165b1/transformer/__init__.py
transformer/__init__.py
python
MIT
eeea9f13805d21a91071beae0f1403fcfe9165b1
2026-01-05T07:08:59.727233Z
false
DadaNanjesha/AI-Text-Humanizer-App
https://github.com/DadaNanjesha/AI-Text-Humanizer-App/blob/eeea9f13805d21a91071beae0f1403fcfe9165b1/transformer/app.py
transformer/app.py
import ssl import random import warnings import nltk import spacy from nltk.tokenize import word_tokenize from nltk.corpus import wordnet from sentence_transformers import SentenceTransformer, util warnings.filterwarnings("ignore", category=FutureWarning) NLP_GLOBAL = spacy.load("en_core_web_sm") def download_nltk_...
python
MIT
eeea9f13805d21a91071beae0f1403fcfe9165b1
2026-01-05T07:08:59.727233Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/batch_normalization/__init__.py
batch_normalization/__init__.py
"""Example of batch normalization tackling a difficult optimization. Running with --no-batch-normalize, we see that the algorithm makes very very slow progress in the same amount of time. """ import argparse from theano import tensor from blocks.algorithms import Adam, GradientDescent from blocks.bricks import MLP, B...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/sqrt/__main__.py
sqrt/__main__.py
"""Super-basic example, mainly for testing purposes. This script trains a tiny network to compute square roots. """ import argparse import logging from sqrt import main if __name__ == "__main__": logging.basicConfig( level=logging.INFO, format="%(asctime)s: %(name)s: %(levelname)s: %(message)s"...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/sqrt/__init__.py
sqrt/__init__.py
import numpy import theano from theano import tensor from blocks.algorithms import GradientDescent, Scale from blocks.bricks import MLP, Tanh, Identity from blocks.bricks.cost import SquaredError from blocks.graph import ComputationGraph from blocks.initialization import IsotropicGaussian, Constant from blocks.model ...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/machine_translation/stream.py
machine_translation/stream.py
import numpy from fuel.datasets import TextFile from fuel.schemes import ConstantScheme from fuel.streams import DataStream from fuel.transformers import ( Merge, Batch, Filter, Padding, SortMapping, Unpack, Mapping) from six.moves import cPickle def _ensure_special_tokens(vocab, bos_idx=0, eos_idx=0, unk_idx=1...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/machine_translation/sampling.py
machine_translation/sampling.py
from __future__ import print_function import logging import numpy import operator import os import re import signal import time from blocks.extensions import SimpleExtension from blocks.search import BeamSearch from subprocess import Popen, PIPE logger = logging.getLogger(__name__) class SamplingBase(object): ...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/machine_translation/model.py
machine_translation/model.py
from theano import tensor from toolz import merge from blocks.bricks import (Tanh, Maxout, Linear, FeedforwardSequence, Bias, Initializable, MLP) from blocks.bricks.attention import SequenceContentAttention from blocks.bricks.base import application from blocks.bricks.lookup import LookupTa...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/machine_translation/__main__.py
machine_translation/__main__.py
"""Encoder-Decoder with search for machine translation. In this demo, encoder-decoder architecture with attention mechanism is used for machine translation. The attention mechanism is implemented according to [BCB]_. The training data used is WMT15 Czech to English corpus, which you have to download, preprocess and pu...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/machine_translation/checkpoint.py
machine_translation/checkpoint.py
import logging import numpy import os import time from contextlib import closing from six.moves import cPickle from blocks.extensions.saveload import SAVED_TO, LOADED_FROM from blocks.extensions import TrainingExtension, SimpleExtension from blocks.serialization import secure_dump, load, BRICK_DELIMITER from blocks....
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/machine_translation/configurations.py
machine_translation/configurations.py
def get_config_cs2en(): config = {} # Model related ----------------------------------------------------------- # Sequences longer than this will be discarded config['seq_len'] = 50 # Number of hidden units in encoder/decoder GRU config['enc_nhids'] = 1000 config['dec_nhids'] = 1000 ...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/machine_translation/__init__.py
machine_translation/__init__.py
import logging from collections import Counter from theano import tensor from toolz import merge from blocks.algorithms import (GradientDescent, StepClipping, AdaDelta, CompositeRule) from blocks.extensions import FinishAfter, Printing from blocks.extensions.monitoring import TrainingDa...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/machine_translation/prepare_data.py
machine_translation/prepare_data.py
#!/usr/bin/python import argparse import logging import os import subprocess import tarfile import urllib2 import uuid from picklable_itertools.extras import equizip TRAIN_DATA_URL = 'http://www.statmt.org/wmt15/training-parallel-nc-v10.tgz' VALID_DATA_URL = 'http://www.statmt.org/wmt15/dev-v2.tgz' PREPROCESS_URL = ...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/tests/test_markov_chain.py
tests/test_markov_chain.py
import tempfile from markov_chain import main def test_markov_chain(): with tempfile.NamedTemporaryFile() as f: main("train", f.name, None, 10)
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/tests/test_parity_problem.py
tests/test_parity_problem.py
from parity_problem import main def test_parity_problem(): main_loop = main(20, 1, 10, 10, 1) assert main_loop.log.status['epochs_done'] == 1 assert main_loop.log.status['iterations_done'] == 10
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/tests/test_mnist.py
tests/test_mnist.py
import tempfile from blocks.serialization import load from mnist import main def test_mnist(): with tempfile.NamedTemporaryFile() as f: main(f.name, 1) with open(f.name, "rb") as source: main_loop = load(source) main_loop.find_extension("FinishAfter").set_conditions( ...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/tests/test_batch_normalization.py
tests/test_batch_normalization.py
from batch_normalization import main def test_batch_normalization_example(): bn_main_loop = main(num_epochs=2) assert bn_main_loop.log.current_row['test_misclass'] < 0.62 assert bn_main_loop.log.current_row['train_misclass'] < 0.6 nbn_main_loop = main(num_epochs=2, batch_normalized=False) assert n...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/tests/test_sqrt.py
tests/test_sqrt.py
import tempfile from blocks.extensions.saveload import SAVED_TO from sqrt import main def test_sqrt(): save_path = tempfile.mktemp() main_loop = main(save_path, 7) assert main_loop.log[7][SAVED_TO][0] == save_path
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/tests/test_mnist_lenet.py
tests/test_mnist_lenet.py
import tempfile from blocks.serialization import load from mnist_lenet import main def test_mnist_lenet(): with tempfile.NamedTemporaryFile() as f: main(f.name, 1, num_batches=3) with open(f.name, "rb") as source: main_loop = load(source) main_loop.find_extension("FinishAfter").se...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/tests/__init__.py
tests/__init__.py
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/tests/test_reverse_words.py
tests/test_reverse_words.py
from __future__ import print_function import tempfile import sys from six.moves import StringIO from blocks.config import config from reverse_words import main def test_reverse_words(): old_limit = config.recursion_limit config.recursion_limit = 100000 with tempfile.NamedTemporaryFile() as f_save,\ ...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/tests/test_machine_translation.py
tests/test_machine_translation.py
import numpy import tempfile import theano from blocks.initialization import IsotropicGaussian, Orthogonal, Constant from blocks.model import Model from machine_translation.model import BidirectionalEncoder, Decoder from machine_translation.stream import get_tr_stream, get_dev_stream from numpy.testing import assert...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/markov_chain/dataset.py
markov_chain/dataset.py
"""Defines the dataset for a Markov chain. Has to be in a separate module from the main script in order to be unpicklable by a third party. """ import numpy import copy from fuel.datasets import Dataset class MarkovChainDataset(Dataset): """Training data generator.""" num_states = 3 trans_prob = numpy....
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/markov_chain/__main__.py
markov_chain/__main__.py
import argparse import logging from . import main if __name__ == "__main__": logging.basicConfig( level=logging.INFO, format="%(asctime)s: %(name)s: %(levelname)s: %(message)s") parser = argparse.ArgumentParser( "Case study of generating a Markov chain with RNN.", formatter_cla...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/markov_chain/__init__.py
markov_chain/__init__.py
#!/usr/bin/env python """Learn a Markov chain with an RNN and sample from it.""" from __future__ import print_function import logging import pprint import sys from six.moves import cPickle import numpy import theano from theano import tensor from blocks.bricks import Tanh from blocks.bricks.recurrent import GatedRec...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/parity_problem/__main__.py
parity_problem/__main__.py
"""This example shows how to train a simple RNN for the sequence classification task: given a sequence of 0s and 1s, determine whether number of 1s in it is odd or even """ import argparse import logging from parity_problem import main if __name__ == "__main__": logging.basicConfig( level=logging.INFO, ...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/parity_problem/__init__.py
parity_problem/__init__.py
from __future__ import print_function import random import numpy as np import theano import theano.tensor as T from fuel.streams import DataStream from fuel.datasets import IterableDataset from blocks.bricks import Linear, Logistic from blocks.bricks.recurrent import LSTM from blocks.bricks.cost import BinaryCrossEn...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/reverse_words/__main__.py
reverse_words/__main__.py
#!/usr/bin/env python """Learn to reverse the letters in each word in text In this demo, a recurrent network equipped with an attention mechanism learns to reverse each word (on a character-by-character basis) in its input text. The default training data is the Google Billion Word corpus, which you should download a...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/reverse_words/__init__.py
reverse_words/__init__.py
from __future__ import print_function import logging import pprint import math import numpy import traceback import operator import theano from six.moves import input from picklable_itertools.extras import equizip from theano import tensor from blocks.bricks import Tanh, Initializable from blocks.bricks.base import a...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/mnist_lenet/__init__.py
mnist_lenet/__init__.py
"""Convolutional network example. Run the training for 50 epochs with ``` python __init__.py --num-epochs 50 ``` It is going to reach around 0.8% error rate on the test set. """ import logging import numpy from argparse import ArgumentParser from theano import tensor from blocks.algorithms import GradientDescent, S...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
mila-iqia/blocks-examples
https://github.com/mila-iqia/blocks-examples/blob/7d30adff73140b6a873047b062077b4c12bd9099/mnist/__init__.py
mnist/__init__.py
#!/usr/bin/env python import logging from argparse import ArgumentParser from theano import tensor from blocks.algorithms import GradientDescent, Scale from blocks.bricks import MLP, Tanh, Softmax from blocks.bricks.cost import CategoricalCrossEntropy, MisclassificationRate from blocks.initialization import Isotropi...
python
MIT
7d30adff73140b6a873047b062077b4c12bd9099
2026-01-05T07:09:00.712415Z
false
vintasoftware/django-zombodb
https://github.com/vintasoftware/django-zombodb/blob/2391f27709819bd135e3d0dd571ef42e6996a201/test_manage.py
test_manage.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings") from django.core.management import execute_from_command_line execute_from_command_line(...
python
MIT
2391f27709819bd135e3d0dd571ef42e6996a201
2026-01-05T07:09:01.604399Z
false
vintasoftware/django-zombodb
https://github.com/vintasoftware/django-zombodb/blob/2391f27709819bd135e3d0dd571ef42e6996a201/setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys try: from setuptools import setup except ImportError: from distutils.core import setup def get_version(*file_paths): """Retrieves the version from django_zombodb/__init__.py""" filename = os.path.join(os.path.dirname(__file...
python
MIT
2391f27709819bd135e3d0dd571ef42e6996a201
2026-01-05T07:09:01.604399Z
false
vintasoftware/django-zombodb
https://github.com/vintasoftware/django-zombodb/blob/2391f27709819bd135e3d0dd571ef42e6996a201/runtests.py
runtests.py
#!/usr/bin/env python # -*- coding: utf-8 from __future__ import absolute_import, unicode_literals import os import sys from django.core.management import execute_from_command_line def runtests(): os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings") argv = sys.argv[:1] + ['test'] + sys.argv[1:]...
python
MIT
2391f27709819bd135e3d0dd571ef42e6996a201
2026-01-05T07:09:01.604399Z
false