Skip to content

Instantly share code, notes, and snippets.

View offchan42's full-sized avatar
🐳
Deep Learning with Generative AI

Chanchana Sornsoontorn offchan42

🐳
Deep Learning with Generative AI
View GitHub Profile
@offchan42
offchan42 / load_stable_diffusion_pipeline.py
Last active March 25, 2023 06:13
Load stable diffusion pipeline with model cache in google drive. Use in Colab
cache_dir = "/root/.cache/huggingface/hub"
!ln -fs /content/drive/MyDrive/huggingface_hub_cache $cache_dir
from diffusers import StableDiffusionPipeline
import torch
model_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id, cache_dir=cache_dir, torch_dtype=torch.float16)
pipe = pipe.to("cuda")
@offchan42
offchan42 / build_openvr_samples.md
Last active October 9, 2020 09:02
How to properly build OpenVR samples for Windows 10

Building OpenVR Samples

Here are suggestions for building the OpenVR samples for Windows 10:

  • The main thing to do to make sure you will not have too many problems is to use the exact same version of everything it asks you to do and strictly follow every advice.
  • Install VS 2013, even though the latest version is 2019. It will come with the appropriate build tool.
  • Install Qt which have MSVC2013, the old open source Qt version. You only need this MSVC2013 component. Nothing else is needed.
  • Build the project using VS 2013 (make sure to set Release), the latest command cmake --build . --target all --config Release doesn't work.

Here's the result for overlay sample: image

Using TensorFlow Object Detection API on Windows 10

  1. Install TensorFlow 1.14 (not 2)
  2. Download https://github.com/tensorflow/models/ repository
  3. Add models/, models/research/, and models/research/slim/ to the PYTHONPATH variable.
  4. Install pycocotoolsfrom this clone (works with Windows): https://github.com/philferriere/cocoapi
  5. Follow installation guide from https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md (Except the cocoapi part)
  6. Download https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 for inference script in webcam and TFRecord data generator script
  7. Mainly, try to follow this local training guide and fix the bug one by one by providing the requirements: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_locally.md
@offchan42
offchan42 / install-tensorflow-gpu-windows.md
Last active August 3, 2021 18:45
How to install TensorFlow GPU on Windows without installing CUDA Toolkit manually and ensure training speedup

Installation

Follow this guide to install TensorFlow GPU on Windows (without the need to manually install CUDA Toolkit): https://www.pugetsystems.com/labs/hpc/How-to-Install-TensorFlow-with-GPU-Support-on-Windows-10-Without-Installing-CUDA-UPDATED-1419 CUDA will be installed for you automatically using Anaconda.

Or just follow the Fast Instructions I wrote below.

If you want to install CUDA toolkit on your own, or if you want to install the latest tensorflow version, then you need to follow official installation guide.

Fast Instructions

@offchan42
offchan42 / visual-studio-summary.md
Last active October 6, 2020 10:15
Short Summary of (some language) development in Visual Studio

Building and using DLL in Visual C++

  1. Create a library project to build DLL file. You will get .lib, .dll, and .h files.

  2. Create another project to use the DLL file. Then follow steps 2 to 6 on this project. You need to tell Visual Studio where to find the header files and library files via its Properties window.

  3. Go to project Properties > C/C++ > General and set Additional Include Directories to directory for header files (.h). (Or you can just copy the header files into your project.)

If you build the project, you will get error LNK2019: unresolved external symbol because there is no library file yet.

@offchan42
offchan42 / bfg.bat
Last active January 3, 2019 20:08
Alias file for git-bfg repo cleaner
:: Put this file and `bfg.jar` into a dedicated folder for aliases like `C:\Aliases`.
:: And ensure that you add the folder path to `PATH` environment variable.
:: Then you would be able to call `bfg` inside command prompt.
@echo off
echo.
java -jar %~dp0\bfg.jar %*
@offchan42
offchan42 / social_anxiety.md
Last active September 23, 2021 13:31
Social anxiety resources; How to deal with life when you are painfully shy
@offchan42
offchan42 / resistance_training_guide.md
Last active June 16, 2023 10:13
No bullsh*t resistance training and diet guide for improving your physique and performance. To obtain spectacular changes, we must train both your body and your mind.

Resistance training introduction

Resistance training A.K.A. strength training A.K.A. weight training is done by lifting weights in the gym or using bodyweight in order to improve your physique and performance.

The physique goal might be to gain muscle, lose fat, or maintain your weight.

The performance goal might be to improve strength, endurance, cardiovascularity, power, or technical showoff.

NOTE: I also talk about diet. I'm showing you how to improve your physique in scientifically proven ways. After reading this open-mindedly, you are going to be able to manipulate your bodyweight like crazy.

I also talk about how to eliminate excuses and difficulty for going to the gym. I'll show you how you can train your mind to be a new person.

@offchan42
offchan42 / git_course_draft.md
Last active September 5, 2023 19:15
Git & GitHub course outline draft

What will I learn ?

  • การติดตั้ง Git
  • การใช้งาน Git เบื้องต้น เพื่อการจัดการเวอร์ชันโปรแกรมของเรา
  • การใช้เว็บไซต์ GitHub
  • การอัพโหลดโปรเจ็ค Git ขึ้นสู่ GitHub เพื่อใช้งานร่วมกับคนอื่น
  • การใช้คำสั่งมีประโยชน์ต่างๆ เช่น git blame, git bisect, ...

Requirements

  • มีความคุ้นเคยกับโค้ดโปรแกรม (ไม่จำเป็นต้องเขียนเป็น)
  • มีความกระตือรือร้นที่จะฝึกฝนทักษะ, ถาม, และค้นหา
Data: [ 70. 91. 52. 67. 80. 93. 74. 40. 89. 45. 61. 82.
96. 50. 64. 85. 100. 56. 98. 41. 87. 68. 43. 65.
75. 62. 54. 47. 48. 72.]
===Beginning Parameters===
Group 1; MEAN = 45.00, SD = 3.00
Group 2; MEAN = 65.00, SD = 3.00
Group 3; MEAN = 85.00, SD = 3.00
Reading 70.0
This data is in group 2
MEAN: 66.6666666667 SD: 4.8218253805