brunch

You can make anything
by writing

C.S.Lewis

by 무명 May 20. 2020

[삽질저장용] 머신러닝 모델 서빙서버 만들기

bert, sagemaker, aws, ec2, nboost,lambda

https://pypi.org/project/nboost/

https://hanxiao.io/2019/07/29/Generic-Neural-Elastic-Search-From-bert-as-service-and-Go-Way-Beyond/#gnes-preliminaries-breakdown-of-neural-elastic-and-search

https://github.com/hanxiao/bert-as-service#using-bert-as-service-to-serve-http-requests-in-json




http://www.lib4dev.in/info/koursaros-ai/nboost/LICENSE#setting-up-an-elasticsearch-server

Train and Deploy the Mighty BERT based NLP models using FastBert and Amazon SageMaker

https://medium.com/@kaushaltrivedi/train-and-deploy-mighty-transformer-nlp-models-using-fastbert-and-aws-sagemaker-cc4303c51cf3

언급된것처럼 gpu 서버 너무 비쌈...



https://beomi.github.io/2018/03/18/Create_GPU_spot_EC2_for_ML/


https://github.com/tensorflow/serving/blob/master/tensorflow_serving/g3doc/docker.md

간단하게 tf 서빙서버를 만드는 것도 방법이나 bert 를 쓸거면 bert를 쓰는게 나을 거라고 판단. 

http://blog.naver.com/PostView.nhn?blogId=wideeyed&logNo=221566170795&categoryNo=56&parentCategoryNo=0&viewDate=¤tPage=1&postListTopCurrentPage=1&from=search

https://tensorflowkorea.gitbooks.io/tensorflow-kr/content/g3doc/tutorials/tfserve/

https://www.tensorflow.org/tfx/serving/docker

https://www.tensorflow.org/tfx/serving/serving_advanced

https://www.tensorflow.org/guide/saved_model?hl=ko

https://www.tensorflow.org/tutorials/keras/save_and_load?hl=ko

https://zzsza.github.io/data/2018/07/12/tensorflow-serving-tutorial/


https://gusrb.tistory.com/37

https://www.tensorflow.org/tfx/serving/api_rest




https://cloud.google.com/solutions/machine-learning/building-real-time-embeddings-similarity-matching-system?hl=ko

보고 깜짝 놀람, 자사 gcp 서비스들을 이용해서 시스템 구축하는걸 다 문서화해놓음; 

gcp 를 썼다면 이런 문서들을 기반으로 text-embedding 시스템을 구축했을 것. 



https://github.com/GoogleCloudPlatform/realtime-embeddings-matching/tree/master/text-semantic-search



aws arn

이걸로 lambda 세팅할 때 도움 많이 받음. ㅠㅠ 물론 이걸 사용하는 일은 없었다고 한다. 

https://github.com/antonpaquin/Tensorflow-Lambda-Layer/blob/master/arn_tables/tensorflow_keras.md




https://towardsdatascience.com/word-embedding-using-bert-in-python-dd5a86c00342

https://bert-as-service.readthedocs.io/en/latest/source/server.html

https://github.com/DemisEom/bertsearch

이걸로 쉽게 돌려볼 수 있었을까?

https://github.com/Hironsan/bertsearch

https://bert-as-service.readthedocs.io/en/latest/source/server.html

https://www.elastic.co/kr/blog/text-similarity-search-with-vectors-in-elasticsearch



https://github.com/mikepm35/TfLambdaDemo

https://medium.com/@mike.p.moritz/running-tensorflow-on-aws-lambda-using-serverless-5acf20e00033




https://www.youtube.com/watch?v=neHlZCMUN8U

https://www.slideshare.net/awskorea/aws-lambda-tensorflow-keras-inferences


https://mc.ai/serverless-vision-inference-using-aws-lambda-and-tflite/

tflite로도 뭔갈 해보려고 했으나 잘 되지 않음. 결국 런타임을 lambda 에서 돌리는데는 무리가 있었음. 



https://m.blog.naver.com/PostView.nhn?blogId=olpaemi&logNo=221639136195&proxyReferer=https:%2F%2Fwww.google.com%2F


https://aws.amazon.com/ko/blogs/korea/build-a-serverless-frontend-for-an-amazon-sagemaker-endpoint/


https://aws.amazon.com/ko/blogs/machine-learning/enhanced-text-classification-and-word-vectors-using-amazon-sagemaker-blazingtext/

https://github.com/haandol/mxnet-elastic-inference/blob/master/MXNet%20SSD%20on%20AWS%20Elastic%20Inference.ipynb


https://medium.com/circuitpeople/serverless-large-file-downloads-to-s3-a11b4ef4788e

https://blog.haandol.com/2020/03/07/search-keyword-correction.html

https://docs.aws.amazon.com/ko_kr/dlami/latest/devguide/tutorial-tfserving.html



https://gist.github.com/nacyot/8366310

삽질한다고 도커 많이 써봄. 

수확이었다. 



https://stackoverflow.com/questions/30604846/docker-error-no-space-left-on-device

ec2 t2.micro에다가 이것저것 설치하다보니 마주한 문제. 

https://aws.amazon.com/ko/premiumsupport/knowledge-center/batch-job-failure-disk-space/




https://aws.amazon.com/ko/blogs/machine-learning/deploy-trained-keras-or-tensorflow-models-using-amazon-sagemaker/



https://tfhub.dev/tensorflow/bert_multi_cased_L-12_H-768_A-12/2

구글이 최고여




https://urbanbase.github.io/dev/2019/10/24/Machine-Learning-Prototype.html

https://github.com/harusametime/sagemaker-notebooks/tree/master/tf_bert_classifier/src/bert

https://github.com/harusametime/sagemaker-notebooks/tree/master/tf_bert_classifier/src/bert#pre-trained-models

https://github.com/harusametime/sagemaker-notebooks/tree/master/tf_bert_classifier/src/bert#fine-tuning-with-bert



https://hackernoon.com/exploring-the-aws-lambda-deployment-limits-9a8384b0bec3



https://github.com/serverless/serverless



https://dreamgonfly.github.io/2018/01/19/pytorch-on-aws-lambda.html

사실 삽질중에 pytorch 서빙서버가 공식으로 aws에서 나와서 좀 고민하긴했음.


https://www.freecodecamp.org/news/what-we-learned-by-serving-machine-learning-models-using-aws-lambda-c70b303404a1/


https://github.com/tgjeon/TF-Eager-Execution-Guide-KR/blob/master/guide.md


https://aws.amazon.com/ko/blogs/machine-learning/how-to-deploy-deep-learning-models-with-aws-lambda-and-tensorflow/




https://www.whatap.io/ko/blog/37/


https://github.com/mikepm35/TfLambdaDemo

https://medium.com/smellslikeml/serverless-vision-inference-using-aws-lambda-and-tflite-613c084f64d2


https://aws.amazon.com/ko/blogs/machine-learning/deploy-trained-keras-or-tensorflow-models-using-amazon-sagemaker/?nc1=h_ls

https://github.com/aws/sagemaker-tensorflow-serving-container



https://github.com/jina-ai/jina/tree/master/docs/chapters/101

이것도 신기하긴했음. 

https://docs.jina.ai/api/jina.html

https://github.com/jina-ai/examples/tree/master/x-as-service

https://course.fast.ai/#pytorch-and-fastai


http://xplordat.com/2019/10/28/semantics-at-scale-bert-elasticsearch/


https://towardsdatascience.com/how-we-built-an-ai-powered-search-engine-without-being-google-5ad93e5a8591



https://github.com/ryfeus/lambda-packs



lambda pack들, 람다 세팅할 때 도움이 많이 됨. 



https://mc.ai/serving-pytorch-nlp-models-on-aws-lambda/


https://www.tensorflow.org/tfx/serving/serving_config#reloading_model_server_configuration

https://www.tensorflow.org/tfx/serving/custom_source

https://www.tensorflow.org/tfx/serving/signature_defs#objective


https://github.com/hanxiao/bert-as-service/issues/221

https://towardsdatascience.com/how-to-build-a-semantic-search-engine-in-3-minutes-9e579da92913

https://towardsdatascience.com/serving-tensorflow-models-serverless-6a39614094ff

https://antilibrary.org/2259




https://github.com/kaushaltrivedi/fast-bert

fast bert, bert 종류들 많아서 다 살펴볼만



매거진의 이전글 [AWS/EC2]cpu로 bert서빙서버 돌리기
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari