Skip to content

Instantly share code, notes, and snippets.

View AnyISalIn's full-sized avatar
🛫

AnyISalIn AnyISalIn

🛫
View GitHub Profile
@AnyISalIn
AnyISalIn / lcm-vs-origin.py
Created November 10, 2023 08:27
LCM-LoRA vs Origin Model
# Copyright 2023 https://novita.ai
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
@AnyISalIn
AnyISalIn / ipynb
Last active September 21, 2023 05:57
fuse/unfuse multiple lora
This file has been truncated, but you can view the full file.
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "ce75a926-c68b-4ea7-947f-1d20f7ced1c6",
"metadata": {},
"outputs": [],
"source": [
"!"
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: cleaner
namespace: tekton-pipelines
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
import pandas
import numpy as np
from scipy.stats import randint
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification
rng = np.random.RandomState(0)
X, y = make_classification(n_samples=100000000, n_features=500, random_state=rng)
with open('input', 'w') as f:
f.write(str(X[0]))
f.write("\n")
@AnyISalIn
AnyISalIn / models.py
Last active December 9, 2019 03:23
TerraformWrapper
import delegator
import os
import json
from service import TerraformManagerService
class Provider:
def __init__(self, config):
self.config = config
class Template:
/*
* Flush stats to Zabbix (http://www.zabbix.com/).
*
* To enable this backend, include 'statsd-zabbix-backend'
* in the backends configuration array:
*
* backends: ['statsd-zabbix-backend']
*
* This backend supports the following config options:
*

容器的使用场景

应用部署

实际上,容器技术流行之后最受益的是开发者,因为开发者可以借助容器技术快速的部署好开发测试环境,也可以将自己的应用打包成一个镜像发放出去,用户可以直接拥有和开发者相同的环境,不需要繁琐的部署

CI/CD(持续集成、持续部署)

容器非常适合敏捷开发模式,开发者将代码通过 svn/git 提交到远程仓库后,通过 jenkins/gitlab-ci 等持续集成工具直接构建包含最新代码的镜像,运行测试,测试成功后自动将新版本的代码的镜像滚动更新到线上环境,完全自动化,解放运维

为什么要自定义 Field 类型

首先,Django ModelForm 是根据 Model 属性的类型去生成对应的 Field 的类型,如果是 String,就是 TextInput,列表就是 MultiChoice/MultiValue,Password 就是 PasswordInput,但是我博客里面新建/修改文章的 Tag 是以一个 , 来分隔的,就像下面这一样。

所以我需要用 TextInput,并且 clean 直接不做任何处理直接返回,但是在 ArticleFormclean_tag_listsave 这两个方法里面处理 Tag

def clean_tag_list(self):
import logging
import time
from socket import *
from influxdb import InfluxDBClient
GRAPHITE_HOST = '192.168.20.103'
GRAPHITE_PORT = 2003
INFLUXDB_HOST = '192.168.20.183'
INFLUXDB_DATABASE = 'water_quality'
@AnyISalIn
AnyISalIn / db.py
Last active August 7, 2017 05:33
water_quality collect
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Float, Boolean
Base = declarative_base()
engine = create_engine('mssql+pymssql://sa:passwd1Q@192.168.20.183/tempdb')
Session = sessionmaker(bind=engine)
session = Session()