Skip to content

Instantly share code, notes, and snippets.

View iml1111's full-sized avatar
💭
hi, i'm iml.

IML iml1111

💭
hi, i'm iml.
View GitHub Profile
@ddanier
ddanier / fastapi_globals.py
Last active August 17, 2024 08:22
flask.g for FastAPI.
"""
This allows to use global variables inside the FastAPI application using async mode.
# Usage
Just import `g` and then access (set/get) attributes of it:
```python
from your_project.globals import g
@GavinXing
GavinXing / mini-word2vec-pytorch.py
Created August 6, 2017 01:44
A complete word2vec based on pytorch tutorial
# encoding=utf-8
# Project: learn-pytorch
# Author: xingjunjie github: @gavinxing
# Create Time: 29/07/2017 11:58 AM on PyCharm
# Basic template from http://pytorch.org/tutorials/beginner/nlp/word_embeddings_tutorial.html
import torch
import torch.nn as nn
import torch.autograd as autograd
import torch.optim as optim