Text Generation
PEFT
Safetensors
Transformers
qwen2
lora
coding
code-generation
conversational
text-generation-inference
Instructions to use girish00/ConicAI_LLM_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use girish00/ConicAI_LLM_model with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-0.5B-Instruct") model = PeftModel.from_pretrained(base_model, "girish00/ConicAI_LLM_model") - Transformers
How to use girish00/ConicAI_LLM_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="girish00/ConicAI_LLM_model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("girish00/ConicAI_LLM_model") model = AutoModelForCausalLM.from_pretrained("girish00/ConicAI_LLM_model", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use girish00/ConicAI_LLM_model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "girish00/ConicAI_LLM_model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "girish00/ConicAI_LLM_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/girish00/ConicAI_LLM_model
- SGLang
How to use girish00/ConicAI_LLM_model 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 "girish00/ConicAI_LLM_model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "girish00/ConicAI_LLM_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "girish00/ConicAI_LLM_model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "girish00/ConicAI_LLM_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use girish00/ConicAI_LLM_model with Docker Model Runner:
docker model run hf.co/girish00/ConicAI_LLM_model
add dedicated endpoint cloud mode
Browse files58 unmodified lines59606162636437 unmodified lines10210310410510610710814 unmodified lines1231241251261271281291301317 unmodified lines13914014114214314414514614714814915015115215315415515615715815916016116216316458 unmodified linesreturn bodydef run_local_fallback(args, reason):if not args.fallback_model_path:raise RuntimeError(reason)37 unmodified linesdef main():parser = argparse.ArgumentParser()parser.add_argument("--repo-id", type=str, required=True)parser.add_argument("--prompt", type=str, required=True)parser.add_argument("--token", type=str, default=os.getenv("HF_TOKEN"))parser.add_argument(14 unmodified linesargs = parser.parse_args()if args.no_local_fallback:args.fallback_model_path = ""token = args.token or get_token()client = InferenceClient(model=args.repo_id, token=token)prompt_text = build_instruction_prompt(args.prompt)generation_kwargs = {7 unmodified linesgeneration_kwargs["temperature"] = 0.01start_time = time.perf_counter()try:response = client.text_generation(prompt_text, **generation_kwargs)except TypeError:generation_kwargs.pop("return_full_text", None)try:response = client.text_generation(prompt_text, **generation_kwargs)except Exception as exc:try:response = call_direct_inference_api(args.repo_id, token, prompt_text, generation_kwargs)except Exception as direct_exc:run_local_fallback(args, f"{exc}; direct API fallback failed: {direct_exc}")returnexcept Exception as exc:try:response = call_direct_inference_api(args.repo_id, token, prompt_text, generation_kwargs)except Exception as direct_exc:run_local_fallback(args, f"{exc}; direct API fallback failed: {direct_exc}")returnlatency_ms = int((time.perf_counter() - start_time) * 1000)generated_text = normalize_hf_response(response).strip()58 unmodified lines596061626364656667686970717273747576777879808182838485868737 unmodified lines12512612712812913013113213313413513613714 unmodified lines1521531541551561571581591601617 unmodified lines16917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120258 unmodified linesreturn bodydef call_endpoint_url(endpoint_url, token, prompt_text, generation_kwargs):headers = {"Content-Type": "application/json"}if token:headers["Authorization"] = f"Bearer {token}"payload = {"inputs": prompt_text,"parameters": generation_kwargs,"options": {"wait_for_model": True},}response = requests.post(endpoint_url, headers=headers, json=payload, timeout=180)try:body = response.json()except ValueError:body = response.textif response.status_code >= 400:raise RuntimeError(f"Endpoint API error {response.status_code}: {body}")if isinstance(body, dict) and body.get("error"):raise RuntimeError(f"Endpoint API error: {body['error']}")return bodydef run_local_fallback(args, reason):if not args.fallback_model_path:raise RuntimeError(reason)37 unmodified linesdef main():parser = argparse.ArgumentParser()parser.add_argument("--repo-id", type=str, default="")parser.add_argument("--endpoint-url",type=str,default=os.getenv("HF_ENDPOINT_URL", ""),help="Dedicated inference endpoint URL. Use this for true cloud inference.",)parser.add_argument("--prompt", type=str, required=True)parser.add_argument("--token", type=str, default=os.getenv("HF_TOKEN"))parser.add_argument(14 unmodified linesargs = parser.parse_args()if args.no_local_fallback:args.fallback_model_path = ""if not args.repo_id and not args.endpoint_url:raise ValueError("Pass --repo-id or --endpoint-url.")token = args.token or get_token()prompt_text = build_instruction_prompt(args.prompt)generation_kwargs = {7 unmodified linesgeneration_kwargs["temperature"] = 0.01start_time = time.perf_counter()if args.endpoint_url:try:response = call_endpoint_url(args.endpoint_url, token, prompt_text, generation_kwargs)except Exception as exc:run_local_fallback(args, str(exc))returnelse:client = InferenceClient(model=args.repo_id, token=token)try:response = client.text_generation(prompt_text, **generation_kwargs)except TypeError:generation_kwargs.pop("return_full_text", None)try:response = client.text_generation(prompt_text, **generation_kwargs)except Exception as exc:try:response = call_direct_inference_api(args.repo_id, token, prompt_text, generation_kwargs)except Exception as direct_exc:run_local_fallback(args, f"{exc}; direct API fallback failed: {direct_exc}")returnexcept Exception as exc:try:response = call_direct_inference_api(args.repo_id, token, prompt_text, generation_kwargs)except Exception as direct_exc:run_local_fallback(args, f"{exc}; direct API fallback failed: {direct_exc}")returnlatency_ms = int((time.perf_counter() - start_time) * 1000)generated_text = normalize_hf_response(response).strip()
infer_cloud.py+53-15