Skip to content

Instantly share code, notes, and snippets.

@phsamuel
phsamuel / optim.png
Last active February 9, 2023 04:19
About optimization
Something seems to be wrong with torch.optim.SGD. Maybe I don't really understand the usage. I tried to replace
SGDMom_points = train_curve(lambda params: SGDMomentum(params, lr=10, momentum=0.9))
with
SGDMom_points = train_curve(lambda params: torch.optim.SGD(params, lr=10, momentum=0.9))
on https://pytorch-lightning.readthedocs.io/en/stable/notebooks/course_UvA-DL/03-initialization-and-optimization.html
@phsamuel
phsamuel / main_trim.py
Created August 30, 2022 22:51
A video trimmer with Qt/ffmpeg/vlc
import sys
from PyQt5.QtWidgets import QApplication, QDialog, QMainWindow, QMessageBox
from PyQt5.uic import loadUi
from PyQt5.QtCore import pyqtSlot as pyQtSlot
from PyQt5.QtCore import QTimer,QDateTime,Qt,QRect
from PyQt5.QtGui import QPainter, QPen, QFont
from PyQt5.QtWidgets import QFileDialog
from time import sleep
@phsamuel
phsamuel / realsense-yolo.ipynb
Created August 3, 2022 15:07
Realsense Yolo test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phsamuel
phsamuel / gist:30d7955070d88cd537d629d97a0225bc
Created April 15, 2022 20:25
PyTorch autograd and linear regression examples
{
"cells": [
{
"cell_type": "markdown",
"id": "ba091f7e",
"metadata": {},
"source": [
"# CS 231n example"
]
},
{
"cells": [
{
"cell_type": "markdown",
"id": "ae9db9ff",
"metadata": {},
"source": [
"# Q1.a. (10 points) create an network to approximate sin(x)\n",
"\n",
"In this problem, you will try to build a three-layer fully connected network to approximate the sin function using PyTorch. There are 100 hidden units in each layer and please use ReLU activation after the first two layers and no activation after the last layer. You should implement your network model as a subclass of [torch.nn.Module](https://pytorch.org/docs/stable/generated/torch.nn.Module.html) "
@phsamuel
phsamuel / python-getting-start.ipynb
Last active February 2, 2022 17:05
Python getting start
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phsamuel
phsamuel / stocks.ipynb
Last active February 3, 2021 02:28
Stock prediction exercise
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Detect circles"
]