dotnet / TorchSharp

A .NET library that provides access to the library that powers PyTorch.
MIT License
1.37k stars 177 forks source link

Suggestions for more examples #266

Open NiklasGustafsson opened 3 years ago

NiklasGustafsson commented 3 years ago

I received these suggestions from @GeorgeS2019 via email:

https://github.com/Apress/pytorch-recipes

https://github.com/Apress/pytorch-recipes/blob/master/Torch_AI_7.ipynb

Has a few NLP examples to “complete” your torchsharp examples • 7.1 Word Embedding • 7.2 Continuous bag of words (CBOW) • 7.3 LSTM Model

imjwang commented 3 years ago

an example for loading and running torchscript models for mobile android/ios inference would be great

NiklasGustafsson commented 3 years ago

@imjwang, do you mean a model that has been built using Pytorch and TorchScript, loaded with .NET, or do you mean training and producing the model using .NET, then exporting to native code via TorchScript?

imjwang commented 3 years ago

the former, a pretrained model that has already been exported to .ts or .pt

GeorgeS2019 commented 3 years ago

PyTorch for Deep Learning: Creating and Deploying Deep Learning Applications

import IPython.display as display
import librosa
import librosa.display
import matplotlib.pyplot as plt
import numpy as np
import random
import torch
import torchaudio
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from pathlib import Path
from PIL import Image
from torch.utils.data import Dataset
from torchvision import models, transforms
import torch
import torch.nn as nn
import torch.utils.data
import torchvision
from functools import partial
from torch import optim
from torch.utils.tensorboard import SummaryWriter
from torchvision import datasets, transforms
imjwang commented 3 years ago

I have Pytorch experience, but am completely new to Xamarin, C#, and .NET eg. I'm still trying to figure out how to correctly import Torchsharp to a Xamarin cross-platform mobile project after installing the nuget package. So any basic Xamarin and C# examples like what @GeorgeS2019 suggested would help tremendously.

Thank you in advance.

GeorgeS2019 commented 12 months ago

WIP Oct 2023 Update

https://github.com/rognarspb/TorchClassifier https://github.com/MIAIONE/TorchSharpTest https://github.com/mlnethub/SegFormer-Segnext-torchsharp/ https://github.com/lijianxin520/torchsharp_baselib https://github.com/rognarspb/TorchClassifier/ https://github.com/ds5678/TorchCategorizationDemo