Instructions to use verseAI/databricks-dolly-v2-3b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use verseAI/databricks-dolly-v2-3b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="verseAI/databricks-dolly-v2-3b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("verseAI/databricks-dolly-v2-3b") model = AutoModelForCausalLM.from_pretrained("verseAI/databricks-dolly-v2-3b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use verseAI/databricks-dolly-v2-3b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "verseAI/databricks-dolly-v2-3b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "verseAI/databricks-dolly-v2-3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/verseAI/databricks-dolly-v2-3b
- SGLang
How to use verseAI/databricks-dolly-v2-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 "verseAI/databricks-dolly-v2-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": "verseAI/databricks-dolly-v2-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 "verseAI/databricks-dolly-v2-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": "verseAI/databricks-dolly-v2-3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use verseAI/databricks-dolly-v2-3b with Docker Model Runner:
docker model run hf.co/verseAI/databricks-dolly-v2-3b
adjust print statements
Browse files
tester.py
CHANGED
|
@@ -26,7 +26,7 @@ Following Sugarman’s death, the Embassy of the United States issued a statemen
|
|
| 26 |
return s
|
| 27 |
|
| 28 |
def mainSimple():
|
| 29 |
-
print("
|
| 30 |
# print(pathlib.Path().resolve())
|
| 31 |
# generate_text_pipline = pipeline(model="databricks/dolly-v2-3b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
|
| 32 |
# generate_text_pipline = pipeline(model="verseAI/databricks-dolly-v2-3b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
|
|
@@ -36,10 +36,10 @@ def mainSimple():
|
|
| 36 |
resp = generate_text_pipline(inputText)
|
| 37 |
respStr = resp[0]["generated_text"]
|
| 38 |
|
| 39 |
-
print(f'
|
| 40 |
-
print(f'
|
| 41 |
|
| 42 |
-
print("
|
| 43 |
|
| 44 |
def getInstrAndContext():
|
| 45 |
context = '''George Washington (February 22, 1732[b] - December 14, 1799) was an American military officer, statesman,
|
|
@@ -50,7 +50,7 @@ and Founding Father who served as the first president of the United States from
|
|
| 50 |
return instr, context
|
| 51 |
|
| 52 |
def mainContext():
|
| 53 |
-
print("
|
| 54 |
workingDir = pathlib.Path().resolve()
|
| 55 |
generate_text_pipline = pipeline(model=workingDir, torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto", return_full_text=True)
|
| 56 |
|
|
@@ -77,11 +77,11 @@ def mainContext():
|
|
| 77 |
else:
|
| 78 |
resp = llm_chain.predict(instruction=instr).lstrip()
|
| 79 |
|
| 80 |
-
print(f'
|
| 81 |
-
print(f'
|
| 82 |
-
print(f'
|
| 83 |
|
| 84 |
-
print("
|
| 85 |
|
| 86 |
if __name__ == "__main__":
|
| 87 |
mainContext()
|
|
|
|
| 26 |
return s
|
| 27 |
|
| 28 |
def mainSimple():
|
| 29 |
+
print("\nIn main simple...")
|
| 30 |
# print(pathlib.Path().resolve())
|
| 31 |
# generate_text_pipline = pipeline(model="databricks/dolly-v2-3b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
|
| 32 |
# generate_text_pipline = pipeline(model="verseAI/databricks-dolly-v2-3b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
|
|
|
|
| 36 |
resp = generate_text_pipline(inputText)
|
| 37 |
respStr = resp[0]["generated_text"]
|
| 38 |
|
| 39 |
+
print(f'\nInput: {inputText}')
|
| 40 |
+
print(f'\nResponse: {respStr}')
|
| 41 |
|
| 42 |
+
print("\nAll Done!\n")
|
| 43 |
|
| 44 |
def getInstrAndContext():
|
| 45 |
context = '''George Washington (February 22, 1732[b] - December 14, 1799) was an American military officer, statesman,
|
|
|
|
| 50 |
return instr, context
|
| 51 |
|
| 52 |
def mainContext():
|
| 53 |
+
print("\nIn main context...")
|
| 54 |
workingDir = pathlib.Path().resolve()
|
| 55 |
generate_text_pipline = pipeline(model=workingDir, torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto", return_full_text=True)
|
| 56 |
|
|
|
|
| 77 |
else:
|
| 78 |
resp = llm_chain.predict(instruction=instr).lstrip()
|
| 79 |
|
| 80 |
+
print(f'\nInput-Context: {context}')
|
| 81 |
+
print(f'\nInput-Instr: {instr}')
|
| 82 |
+
print(f'\nResponse: {resp}')
|
| 83 |
|
| 84 |
+
print("\nAll Done!\n")
|
| 85 |
|
| 86 |
if __name__ == "__main__":
|
| 87 |
mainContext()
|