Skip to content

Instantly share code, notes, and snippets.

View harusametime's full-sized avatar
:octocat:
Loving Sake and coding

Masaki Samejima harusametime

:octocat:
Loving Sake and coding
View GitHub Profile
@harusametime
harusametime / install_PySPQR_ja.md
Last active June 30, 2023 15:42
PySPQRのインストール

PySPQRをインストールしたい

  • ScipyにはSparse matrix向けのQR分解がありません...
  • Dense matrix向けはあります!が,todense()するとメモリで死んでしまいます.
  • SuiteSparseを使うとできるけどpythonで使えない,
  • Python wrapperのPySPQRを使う.

環境

  • Windows 10
  • Microsoft Visual Studio 14.0 (SuiteSparseのコンパイルにいる)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harusametime
harusametime / paddleocr.ipynb
Created May 3, 2021 08:00
PaddleOCRを SageMaker にデプロイする
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harusametime
harusametime / joblib_on_docker.md
Last active February 11, 2022 20:18
Note on joblib with docker

Problem

When passing big arrays to joblib.Parallel in docker container, parallel processing does not start immediately.

Why?

Joblib uses the folder specified by "JOBLIB_TEMP_FOLDER" for memmap of the arrays. Without specifying, JOBLIB_TEMP_FOLDER is set to /dev/shm, which usually has small size and is not enough for the big arrays.

https://pythonhosted.org/joblib/generated/joblib.Parallel.html

Solution

  • Set JOBLIB_TEMP_FOLDER
import boto3
redshift = boto3.client('redshift')
credentials = redshift.get_cluster_credentials(
DbUser='demouser',
DbName='dev',
ClusterIdentifier='redshiftml',
DurationSeconds=3600,
AutoCreate=False
)
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.
@harusametime
harusametime / error_load_npz.md
Last active July 12, 2019 09:07
npz保存時の注意

Numpyで複数のndarrayを保存するとき,npzを使うのは便利だが

import numpy as np

X = np.zeros((100,100))
y = np.zeros(10)

file_path = /home/samejima/data.npz
np.savez(file_path, x = X, y=y) 
import os
import argparse
import tensorflow as tf
# global variables
width = 28
height = 28
n_class = 10
# tfrecord parser
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.