Rust docs for the Windows API

Related tags

GUI windows-docs-rs
Overview

Windows API documentation for Rust

This is an experimental documentation generator for the Rust for Windows project. The documentation is published here:

https://microsoft.github.io/windows-docs-rs/

The modules crate generates the list of module paths to use in the bindings crate.

The bindings crate generates the documentation for the Windows API.

Unfortunately, the documentation cannot easily be published using GitHub Pages because GitHub has a 100MB limit on files and rustdoc generates a few files that are well over that limit. The build also cannot be automated with GitHub Actions as it takes around 30 minutes (mostly single-threaded) and will exhaust the CI build's resources (rustdoc allocates around 20GB of memory) and ultimately fails the build. A major reason for this is that cargo doc generates a multi-gigabyte windows.rs.html file containing the pretty-formatted version of the generated windows.rs file and there does not appear to be a way to exclude source code browsing using the Rust document generator.

It can be manually generated as follows:

C:\git\windows-docs-rs\crates\bindings>cargo doc --no-deps --target-dir ..\..\docs

You then need to be careful to delete any files that are over 100MB before pushing to GitHub.

Comments
  • module 'gtn' has no attribute 'Device' in STC

    module 'gtn' has no attribute 'Device' in STC

    I installed gtn by pip install gtn and tested STC like below

    from criterions.STC import STC
    import random
    import torch
    
    stcloss = STC(blank_idx=0, p0=1, plast=1, thalf=1, reduction="none")
    
    batch_size = 2
    mel_len = 115
    text_len = 25
    num_token = 64
    inputs = torch.randn(mel_len, batch_size, num_token)
    targets = [[random.randint(1, text_len) for _ in range(random.randint(1, num_token))] for _ in range(batch_size)]
    loss = stcloss(inputs, targets)
    

    But when I trying to run code like above. The Error Like below occurs.

    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    <ipython-input-4-b0ecfb513efd> in <module>
          7 inputs = torch.randn(mel_len, batch_size, num_token)
          8 targets = [[random.randint(1, text_len) for _ in range(random.randint(1, num_token))] for _ in range(batch_size)]
    ----> 9 loss = stcloss(inputs, targets)
    
    ~/anaconda3/envs/leecho/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
       1100         if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
       1101                 or _global_forward_hooks or _global_forward_pre_hooks):
    -> 1102             return forward_call(*input, **kwargs)
       1103         # Do not call functions when jit is used
       1104         full_backward_hooks, non_full_backward_hooks = [], []
    
    /data/leecho/xi-stt/xi-stt/model/STCLoss.py in forward(self, inputs, targets)
        212             # concatenate (tokens, <star>, <star>\tokens)
        213             log_probs = torch.cat([log_probs, lse, neglse], dim=2)
    --> 214         return STCLoss(log_probs, targets, prob, self.reduction)
    
    /data/leecho/xi-stt/xi-stt/model/STCLoss.py in forward(ctx, inputs, targets, prob, reduction)
         96             emissions_graphs[b] = g_emissions
         97 
    ---> 98         gtn.parallel_for(process, range(B))
         99 
        100         ctx.auxiliary_data = (losses, scales, emissions_graphs, inputs.shape)
    
    /data/leecho/xi-stt/xi-stt/model/STCLoss.py in process(b)
         71             # create emission graph
         72             g_emissions = gtn.linear_graph(
    ---> 73                 T, Cstar, gtn.Device(gtn.CPU), inputs.requires_grad
         74             )
         75             cpu_data = inputs[b].cpu().contiguous()
    
    AttributeError: module 'gtn' has no attribute 'Device'
    

    Is there any way to solve this problem?

    opened by LEECHOONGHO 7
  • [STC] STC loss ascends while training

    [STC] STC loss ascends while training

    Hello, I'm training ASR model with STC Loss and letter-to-word encoder like below. But when I progress training, STC Loss ascended and became 'Inf' after 12000 step.

    Is there any miss in my implementation? Any help would be appreciated. Thank you.

    training args:

    • num_gpu : 4
    • audio_length_per_gpu : 160s
    • lr : 0.0001~0.001
    • use FullyShardedDataParallel, mix_precision=off
    #   max_word_length : 10
    #   n_letter_symbols : 69 (blank + pad + korean)
    #   n_word_symbols : 12158 (blank + korean_morph 97% in corpus)
    
    #   blank_idx=0, p0=0.05, plast=0.15, thalf=16000
    
    self.criterion = STC(
        blank_idx=self.cfg.blank_idx, 
        p0=self.cfg.p0, 
        plast=self.cfg.plast, 
        thalf=self.cfg.thalf, reduction="mean"
    )
    
    #   model_output : Tensor[batch_size, max_frame_length, n_letter_symbols*max_word_length]
    #   self.l2w_matrix : Tensor[n_letter_symbols*max_word_length, n_word_symbols]
    
    word_level_output = model_output @ self.l2w_matrix
    
    #   word_level_output : Tensor[batch_size, max_frame_length, n_word_symbols]
    
    word_level_output =  F.log_softmax(word_level_output.transpose(1, 0), dim=-1)
    
    loss = self.criterion(word_level_output, word_labels)
    

    stcloss

    opened by LEECHOONGHO 3
  • [STC] Question for STC loss training

    [STC] Question for STC loss training

    Hello, I'm trying to apply STC for my ASR model training.

    Before proceeding with the training, I have a question to ask about STC training mentioned in STC paper [1] If anyone has experimented with the case I posited, please give me advise.

    1. Does STC valid for pDrop=0.01~0.02 data? or do I just have to use CTC?
        data - The 99% reliable data that may contain some typos or sometimes the business name is erased.
    
        1-1. If STC is valid for 1., Is it sufficient to set p_0=0.01, p_max=0.03 for this case?
    
    2.  Adam is not allowed for STC/(WFST)?
    
    3. For future work, I am thinking of using pseudo labeled YouTube data for ASR training.
        In this case, data could have much incorrect labels in it.
        Does STC perform better than CTC even in case of incorrect labeled data training?
    

    Thank you.

    [1] Star Temporal Classification: Sequence Classification with Partially Labeled Data.

    opened by LEECHOONGHO 2
  • RNN model correction

    RNN model correction

    RNN model's default parameters contain stride. There are 2 convolutional layers each with a stride of 2. So for num_feature = 80, get reduced to 80 ->40 ->20. Updated the code to integrate it.

    CLA Signed 
    opened by ronitd 2
  • Open Source STC code; Some code cleanup

    Open Source STC code; Some code cleanup

    Summary

    • Create criterions, models directory and organize files appropriately
    drawing
    • Make __init__.py files empty so that model training works. Otherwise, there were issues with module loading.
    • Will send a follow-up PR to add documentation to STC code

    Test Plan:

    Ran IamDB training and make sure it runs an epoch. Screen Shot 2022-01-29 at 4 22 47 PM

    CLA Signed 
    opened by vineelpratap 1
  • Dumb question for arc_sort func

    Dumb question for arc_sort func

    When should we set the arc_sort(true) ? For example, in https://github.com/facebookresearch/gtn_applications/blob/eb1cb83dda3d3887f980dbd6b697c2c2b6fd1d45/transducer.py#L265 arc_sort was given parameter True. If my understanding is correct, for FSA target, arc_sort(true) and arc_sort(false) would give the exact same result? How do we decide to set it true or false? (When we prefer sort it in olable and when ilabel? )

    opened by yuekaizhang 1
  • Is it possible to get multiple recognition results instead of one?

    Is it possible to get multiple recognition results instead of one?

    It seems that in model.viterbi(self, outputs), only one recognition results will be returned for each sample. Is it possible to return multiple alternates from this decoding method, like beam search? If yes, what would be the recommended decoding algorithm? Will that be time consuming?

    Thanks!

    opened by zhwa 1
  • Organize dataset download scripts

    Organize dataset download scripts

    • Update IAM download script. Previous scripts were not working - https://stackoverflow.com/q/64715260
    • Create a new directories dataset/download and dataset/utils and move the files appropriately
    CLA Signed 
    opened by vineelpratap 0
  • Publish recipes for ngram transitions work

    Publish recipes for ngram transitions work

    Consider this as V0. TODO

    • Test all the recipes again
    • More details to README. Possibly share ltr, WP based tokens, lexion, transition graph directly via S3 ...
    CLA Signed 
    opened by vineelpratap 0
  • For ASR inference, how to use the asg for inference for LibriSpeech or any wav sound with Pytorch?

    For ASR inference, how to use the asg for inference for LibriSpeech or any wav sound with Pytorch?

    Hi. I am planning to try asg to replace the Wav2Vec2 with LM.

    Compairing to the tutorial on CTC at Pytorch, https://pytorch.org/audio/main/tutorials/asr_inference_with_ctc_decoder_tutorial.html

    image

    image I am thinking how to do the same thing with asg to replace the CTC? If it is using the LM model with asg, is it better than wav2vec2LM with CTC? How much the difference?

    Cloud you show me how to do automatic speech recognition with ASG? I hope I would write the decoder in javascript if I understand how it is going.

    opened by JonathanSum 2
  • [STC] Question about ASR training.

    [STC] Question about ASR training.

    Hello, I'm trying to implement ASR model proposed in Star Temporal Classification. But I have some trouble for implementing my first 'word level output ASR model'.

    When I use simple word-to-encoder's one hot tensor(E matrix), STC loss ascends. So I made several modifications to solve this problem.

    (1). I view x : [T, B, A_L × l_max] to x : [T, B, l_max, A_L], apply F.log_softmax(dim=-1) and view it to original shape x : [T, B, A_L × l_max]

    (2). And I apply letter-to-word encoder e_matrix : [A_L × l_max, A_W] by x = x @ e_matrix, and F.log_softmax(torch.exp(x), dim=-1) for STC input.

    The reason I applied softmax for A_L is make x to probability of the appearance of alphabets at each location in the word. And log -> e_matrix -> exp is to convert the one hot sum by e_matrix operation into a probability product.

    1.Is it right for letter-to-word encoder?

    After applying this, STC loss starts from 3.5 and fall to 2.1~2.5 for 15 epoch. But the viterbi decoded(implemented in gtn_applications/criterions/ctc.py) output is always BLANK while checking WER for every predicted output.

    Cause CTC loss and word level classification output has the same result, I assume that this is a problem with the properties of CTC training and word-level output ASR.

    1. Is this an ordinary result?
    2. How many epochs are needed to get results other than blank usually?
    3. How many epochs are needed to reach the highest performance usually?

    I'm sorry to bother you every time.

    opened by LEECHOONGHO 6
  • "MemoryError: std::bad_alloc" while using compose and intersect function.

    I want to compose two gtn, one is for lexicon, and the second is for grammar (LM) which is created from lm_arpa.py file. I am getting "MemoryError: std::bad_alloc" while doing with 250 GB RAM. I am not sure whether this is on the expected lines or not. PFA of both the gtn and code for reproducibility. gu-G.txt gu-L.txt

    Code: gtn.savetxt('gu-LG.txt', gtn.compose(gtn.loadtxt('gu-L.txt'), gtn.loadtxt('gu-G.txt')).arc_sort())

    opened by ronitd 0
Owner
Microsoft
Open source projects and samples from Microsoft
Microsoft
Windows Native Undocumented API for Rust Language 🔥

Windows Native   The Windows-Native Rust library provides a convenient and safe way to access the native Windows undocumented APIs using the Rust prog

null 3 Aug 22, 2023
Tiny library for handling rust strings in windows.

tinywinstr Tiny library for handling rust strings in windows.

Ed Way 1 Oct 25, 2021
A light windows GUI toolkit for rust

Native Windows GUI Welcome to Native Windows GUI (aka NWG). A rust library to develop native GUI applications on the desktop for Microsoft Windows. NW

Gabriel Dube 1.6k Jan 7, 2023
Winsafe-examples - Examples of native Windows applications written in Rust with WinSafe.

WinSafe examples This repo contains several examples of native Win32 applications written in Rust with WinSafe. All examples follow the same program s

Rodrigo 40 Dec 14, 2022
OS-native file dialogs on Linux, OS X and Windows

nfd-rs nfd-rs is a Rust binding to the library nativefiledialog, that provides a convenient cross-platform interface to opening file dialogs on Linux,

Saurav Sachidanand 152 Nov 9, 2022
A small tool to use along with i3/Sway to add CSS-powered decorations to your focused windows, for better usability.

glimmer What A tool for decorating i3 windows when they get focused, written in Rust. classic.mp4 Why When using i3-gaps I ran into the following prob

Daniel Acuña 26 Dec 17, 2022
A tiling window manager for Windows

komorebi Tiling Window Management for Windows. About komorebi is a tiling window manager that works as an extension to Microsoft's Desktop Window Mana

Jade (جاد) 2.6k Jan 1, 2023
OS native dialogs for Windows, MacOS, and Linux

?? nfd2 nfd2 is a Rust binding to the nativefiledialog library, that provides a convenient cross-platform interface to opening file dialogs on Windows

Embark 33 May 15, 2022
A cross-platform Mod Manager for RimWorld intended to work with macOS, linux and Windows

TODOs are available here. Discussions, PRs and Issues are open for anyone who is willing to contribute. rrm Inspired by Spoons rmm. This is a cross-pl

Alejandro Osornio 7 Sep 5, 2022
⚡ A blazing fast alternative to the default Windows delete.

Turbo Delete A blazing fast alternative to the default Windows delete. Turbodelete is a blazing fast alternative to the default Windows delete functio

Tejas Ravishankar 165 Dec 4, 2022
Vibe - a library for acrylic/vibrancy effects for Electron on Windows 10/11

vibe is a library for acrylic/vibrancy effects for Electron on Windows 10/11. Any Electron version compatible with N-API v6 (Electron v11+) is supported.

pyke 23 Dec 14, 2022
A powerful desktop widget app for windows, built with Vue and Tauri.

DashboardX Widgets A powerful desktop widget app for windows, built with Vue and Tauri. Still in development Currently only runs on windows (uses nati

DashboardX Widgets 3 Oct 25, 2023
Crate for simple implementation of Component for Native API 1C:Enterprise written in rust

Гайд по использованию на русском языке можно посмотреть здесь и задать вопросы по использованию, но не оставляйте там комментарии об ошибках, т.к. там

Maxim Kozlov 40 Sep 30, 2023
Termbox is a library that provides minimalistic API which allows the programmer to write text-based user interfaces.

Termbox is a library that provides minimalistic API which allows the programmer to write text-based user interfaces.

null 1.9k Dec 22, 2022
A simple, cross-platform GUI automation module for Rust.

AutoPilot AutoPilot is a Rust port of the Python C extension AutoPy, a simple, cross-platform GUI automation library for Python. For more information,

null 271 Dec 27, 2022
A data-first Rust-native UI design toolkit.

Druid A data-first Rust-native UI toolkit. Druid is an experimental Rust-native UI toolkit. Its main goal is to offer a polished user experience. Ther

null 8.2k Dec 31, 2022
The Rust UI-Toolkit.

The Orbital Widget Toolkit is a cross-platform (G)UI toolkit for building scalable user interfaces with the programming language Rust. It's based on t

Redox OS 3.7k Jan 1, 2023
An easy-to-use, 2D GUI library written entirely in Rust.

Conrod An easy-to-use, 2D GUI library written entirely in Rust. Guide What is Conrod? A Brief Summary Screenshots and Videos Feature Overview Availabl

PistonDevelopers 3.3k Jan 1, 2023
Rust bindings to Core Foundation and other low level libraries on Mac OS X and iOS

core-foundation-rs Compatibility Targets macOS 10.7 by default. To enable features added in macOS 10.8, set Cargo feature mac_os_10_8_features. To hav

Servo 685 Jan 2, 2023