Downloads · 30 days
0
AhmedBou/databricks-dolly-v2-3b_statistical_procedures
databricks-dolly-v2-3b_statistical_procedures is a machine learning model from AhmedBou. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
0
Access
Public
Updated Jun 5, 2023
Repo size
10.5 MB
Likes
0
Public
Click a slice to open those files.
.bin10.5 MB · 100%
From the Hugging Face model README
Requirements:
You can run this model on Google Colab Pro, it requires a substantial amount of VRAM.
<pre> !pip install -q -U bitsandbytes !pip install -q -U git+https://github.com/huggingface/transformers.git !pip install -q -U git+https://github.com/huggingface/peft.git !pip install -q -U git+https://github.com/huggingface/accelerate.git </pre>Import this model using:
<pre> <code> <span style="color: #0000FF;">import</span> torch <span style="color: #0000FF;">from</span> peft <span style="color: #0000FF;">import</span> PeftModel, PeftConfig <span style="color: #0000FF;">from</span> transformers <span style="color: #0000FF;">import</span> AutoModelForCausalLM, AutoTokenizer peft_model_id = <span style="color: #A31515;">"AhmedBou/databricks-dolly-v2-3b_on_NCSS"</span> config = PeftConfig.from_pretrained(peft_model_id) model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=<span style="color: #0000FF;">True</span>, load_in_8bit=<span style="color: #0000FF;">True</span>, device_map=<span style="color: #0000FF;">'auto'</span>) tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path) <span style="color: #808080;"># Load the Lora model</span> model = PeftModel.from_pretrained(model, peft_model_id) </code> </pre>Inference using:
<pre> <code> <span style="color: #0000FF;">batch</span> = tokenizer("Multiple Regression for Appraisal -->: ", return_tensors=<span style="color: #A31515;">'pt'</span>) <span style="color: #0000FF;">with</span> torch.cuda.amp.autocast(): output_tokens = model.generate(**batch, max_new_tokens=<span style="color: #098658;">50</span>) <span style="color: #0000FF;">print</span>(<span style="color: #A31515;">"\n\n"</span>, tokenizer.decode(output_tokens[<span style="color: #098658;">0</span>], skip_special_tokens=<span style="color: #0000FF;">True</span>)) </code> </pre>Output:
<pre> <code> “Multiple Regression for Appraisal” -->: Multiple Regression for Appraisal (MRA) -->: Multiple Regression for Appraisal (MRA) (with Covariates) -->: Multiple Regression for Appraisal (MRA) (with Covariates) </code> </pre>