mirror of
https://github.com/deepseek-ai/DeepSeek-Coder.git
synced 2025-04-20 02:29:09 -04:00
Merge 0f0b1cc802
into b7ba565956
This commit is contained in:
commit
88d9260c48
30
.github/workflows/django.yml
vendored
Normal file
30
.github/workflows/django.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
name: Django CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
max-parallel: 4
|
||||||
|
matrix:
|
||||||
|
python-version: [3.7, 3.8, 3.9]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v3
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r requirements.txt
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
python manage.py test
|
70
.github/workflows/python-publish.yml
vendored
Normal file
70
.github/workflows/python-publish.yml
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# This workflow will upload a Python Package to PyPI when a release is created
|
||||||
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
||||||
|
|
||||||
|
# This workflow uses actions that are not certified by GitHub.
|
||||||
|
# They are provided by a third-party and are governed by
|
||||||
|
# separate terms of service, privacy policy, and support
|
||||||
|
# documentation.
|
||||||
|
|
||||||
|
name: Upload Python Package
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
|
||||||
|
- name: Build release distributions
|
||||||
|
run: |
|
||||||
|
# NOTE: put your own distribution build steps here.
|
||||||
|
python -m pip install build
|
||||||
|
python -m build
|
||||||
|
|
||||||
|
- name: Upload distributions
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-dists
|
||||||
|
path: dist/
|
||||||
|
|
||||||
|
pypi-publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- release-build
|
||||||
|
permissions:
|
||||||
|
# IMPORTANT: this permission is mandatory for trusted publishing
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
# Dedicated environments with protections for publishing are strongly recommended.
|
||||||
|
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
|
||||||
|
environment:
|
||||||
|
name: pypi
|
||||||
|
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
|
||||||
|
# url: https://pypi.org/p/YOURPROJECT
|
||||||
|
#
|
||||||
|
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
|
||||||
|
# ALTERNATIVE: exactly, uncomment the following line instead:
|
||||||
|
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Retrieve release distributions
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-dists
|
||||||
|
path: dist/
|
||||||
|
|
||||||
|
- name: Publish release distributions to PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
with:
|
||||||
|
packages-dir: dist/
|
23
demo/app.py
23
demo/app.py
@ -21,7 +21,6 @@ This Space demonstrates model [DeepSeek-Coder](https://huggingface.co/deepseek-a
|
|||||||
if not torch.cuda.is_available():
|
if not torch.cuda.is_available():
|
||||||
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"
|
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"
|
||||||
|
|
||||||
|
|
||||||
if torch.cuda.is_available():
|
if torch.cuda.is_available():
|
||||||
model_id = "deepseek-ai/deepseek-coder-6.7b-instruct"
|
model_id = "deepseek-ai/deepseek-coder-6.7b-instruct"
|
||||||
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
|
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
|
||||||
@ -29,7 +28,6 @@ if torch.cuda.is_available():
|
|||||||
tokenizer.use_default_system_prompt = False
|
tokenizer.use_default_system_prompt = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@spaces.GPU
|
@spaces.GPU
|
||||||
def generate(
|
def generate(
|
||||||
message: str,
|
message: str,
|
||||||
@ -56,11 +54,12 @@ def generate(
|
|||||||
|
|
||||||
streamer = TextIteratorStreamer(tokenizer, timeout=10.0, skip_prompt=True, skip_special_tokens=True)
|
streamer = TextIteratorStreamer(tokenizer, timeout=10.0, skip_prompt=True, skip_special_tokens=True)
|
||||||
generate_kwargs = dict(
|
generate_kwargs = dict(
|
||||||
{"input_ids": input_ids},
|
input_ids=input_ids,
|
||||||
streamer=streamer,
|
streamer=streamer,
|
||||||
max_new_tokens=max_new_tokens,
|
max_new_tokens=max_new_tokens,
|
||||||
do_sample=False,
|
temperature=temperature,
|
||||||
num_beams=1,
|
top_p=top_p,
|
||||||
|
top_k=top_k,
|
||||||
repetition_penalty=repetition_penalty,
|
repetition_penalty=repetition_penalty,
|
||||||
eos_token_id=tokenizer.eos_token_id
|
eos_token_id=tokenizer.eos_token_id
|
||||||
)
|
)
|
||||||
@ -84,13 +83,13 @@ chat_interface = gr.ChatInterface(
|
|||||||
step=1,
|
step=1,
|
||||||
value=DEFAULT_MAX_NEW_TOKENS,
|
value=DEFAULT_MAX_NEW_TOKENS,
|
||||||
),
|
),
|
||||||
# gr.Slider(
|
gr.Slider(
|
||||||
# label="Temperature",
|
label="Temperature",
|
||||||
# minimum=0,
|
minimum=0,
|
||||||
# maximum=4.0,
|
maximum=4.0,
|
||||||
# step=0.1,
|
step=0.1,
|
||||||
# value=0,
|
value=0.6,
|
||||||
# ),
|
),
|
||||||
gr.Slider(
|
gr.Slider(
|
||||||
label="Top-p (nucleus sampling)",
|
label="Top-p (nucleus sampling)",
|
||||||
minimum=0.05,
|
minimum=0.05,
|
||||||
|
Before Width: | Height: | Size: 344 KiB After Width: | Height: | Size: 344 KiB |
Loading…
Reference in New Issue
Block a user