Instructions to use MILVLG/imp-v1-3b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MILVLG/imp-v1-3b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MILVLG/imp-v1-3b", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("MILVLG/imp-v1-3b", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use MILVLG/imp-v1-3b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MILVLG/imp-v1-3b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MILVLG/imp-v1-3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MILVLG/imp-v1-3b
- SGLang
How to use MILVLG/imp-v1-3b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "MILVLG/imp-v1-3b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MILVLG/imp-v1-3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "MILVLG/imp-v1-3b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MILVLG/imp-v1-3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MILVLG/imp-v1-3b with Docker Model Runner:
docker model run hf.co/MILVLG/imp-v1-3b
Trainable layers impossible to control in Vision Tower
It seems that no matter what setup I chose, whatever layer in the Vision Tower I chose to be trainable like here :
for name, param in self.llm.named_parameters():
param.requires_grad = (('.ln.' in name.lower()
or 'norm' in name.lower() or
'transformer.h.0' in name.lower() or
'vision_model.encoder.layers.0.' in name.lower() or
'vision_model.encoder.layers.1.' in name.lower()) and
('out_proj' not in name.lower()))
it changes nothing, the training behavior is the same, why is that ?
(I printed which layers are trainable and everythink is fine, weirdly pytorch understood well my changes in the Vision Tower because the number of trainable weights changed, and I know I am doing it right because my changes in the trainable layers in the LLM part have an actual impact on the training/val loss and weights value)
We will try to figure out this question. And are you trying to finetune imp in your custom datasets?
Yes I am trying to do that, I did successfully, but the vision tower is resisting me.
Ah okok sure, I was hoping I could just stick to my usual Hugginface model training, but I can try that too when I find some time
I know, the vision tower must be extracted from the model to force the trainable weights.