Model: Shuu12121/CodeSearch-ModernBERT-Finch-Pre
Author: Shuu12121
Pipeline: sentence-similarity
Library: sentence-transformers
Tags: sentence-transformers, safetensors, modernbert, sentence-similarity, feature-extraction, dense, generated_from_trainer, dataset_size:58800, loss:MultipleNegativesRankingLoss, arxiv:1908.10084, arxiv:1705.00652, base_model:Shuu12121/CodeModernBERT-Finch-Pre, base_model:finetune:Shuu12121/CodeModernBERT-Finch-Pre, text-embeddings-inference, endpoints_compatible, region:us
Base models (finetune): id: Shuu12121/CodeModernBERT-Finch-Pre
Card metadata: tags: sentence-transformers, sentence-similarity, feature-extraction, dense, generated_from_trainer, dataset_size:58800, loss:MultipleNegativesRankingLoss
base_model: Shuu12121/CodeModernBERT-Finch-Pre
widget: source_sentence: Returns boolean indicating whether the requestUrl matches against the paths configured.

@param requestedUrl - url requested by user
@param opts - unless configuration
@returns {boolean}
sentences: def xmoe2_v1_l4k_global_only():
  """"""
  hparams = xmoe2_v1_l4k()
  hparams.decoder_layers = [
      "att" if l == "local_att" else l for l in hparams.decoder_layers]
  return hparams, function matchesPath(requestedUrl, opts) {
  var paths = !opts.path || Array.isArray(opts.path) ?
    opts.path : [opts.path];

  if (paths) {
    return paths.some(function(p) {
      return (typeof p === 'string' && p === requestedUrl.pathname) ||
        (p instanceof RegExp && !! p.exec(requestedUrl.pathname));
    });
  }

  return false;
}, public static function factory($accessToken, $currentTeam)
    {
        $client = Client::factory($accessToken);

        return new self($client, $currentTeam);
    }, source_sentence: // New creates a new ImageGraphics including an image.RGBA of dimension w x h
// with background bgcol. If font is nil it will use a builtin font.
// If fontsize is empty useful default are used.
sentences: func New(width, height int, bgcol color.RGBA, font *truetype.Font, fontsize map[chart.FontSize]float64) *ImageGraphics {
	img := image.NewRGBA(image.Rect(0, 0, width, height))
	gc := draw2dimg.NewGraphicContext(img)
	gc.SetLineJoin(draw2d.BevelJoin)
	gc.SetLineCap(draw2d.SquareCap)
	gc.SetStrokeColor(image.Black)
	gc.SetFillColor(bgcol)
	gc.Translate(0.5, 0.5)
	gc.Clear()
	if font == nil {
		font = defaultFont
	}
	if len(fontsize) == 0 {
		fontsize = ConstructFontSizes(13)
	}
	return &ImageGraphics{Image: img, x0: 0, y0: 0, w: width, h: height,
		bg: bgcol, gc: gc, font: font, fs: fontsize}
}, public static void requestDataLogsForApp(final Context context, final UUID appUuid) {
        final Intent requestIntent = new Intent(INTENT_DL_REQUEST_DATA);
        requestIntent.putExtra(APP_UUID, appUuid);
        context.sendBroadcast(requestIntent);
    }, final protected function setWriteMode($mode)
    {
        if (!in_array($mode, [static::WRITE_MODE_INSERT, static::WRITE_MODE_UPSERT, static::WRITE_MODE_UPDATE])) {
            throw new \InvalidArgumentException(sprintf('Passed write mode "%s" is invalid!', $mode));
        }
        $this->writeMode = $mode;
    }, source_sentence: Builds the path for a closed arc, returning a PolygonOptions that can be
further customised before use.

@param center
@param start
@param end
@param arcType Pass in either ArcType.CHORD or ArcType.ROUND
@return PolygonOptions with the paths element populated.
sentences: function getJavaScriptCallbackParameterListSimple(parameters) {
    var result = []

    parameters.forEach(function(parameter){
        if (!parameter.out) return
        result.push("/*" + getIdlType(parameter.type) + "*/ "+ parameter.name)
    })

    return result.join(", ")
}, public Color getBackground() {
		predraw();
		FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
		GL.glGetFloat(SGL.GL_COLOR_CLEAR_VALUE, buffer);
		postdraw();

		return new Color(buffer);
	}, public static final PolygonOptions buildClosedArc(LatLong center, LatLong start, LatLong end, ArcType arcType) {
        MVCArray res = buildArcPoints(center, start, end);
        if (ArcType.ROUND.equals(arcType)) {
            res.push(center);
        }
        return new PolygonOptions().paths(res);
    }, source_sentence: Read data from a spread sheet. Return the data in a dict with
    column numbers as keys.

    sheet: xlrd.sheet.Sheet instance
        Ready for use.

    startstops: list
        Four StartStop objects defining the data to read. See
        :func:`~channelpack.pullxl.prepread`.

    usecols: str or seqence of ints or None
        The columns to use, 0-based. 0 is the spread sheet column
        "A". Can be given as a string also - 'C:E, H' for columns C, D,
        E and H.

    Values in the returned dict are numpy arrays. Types are set based on
    the types in the spread sheet.
sentences: public function handleScanNotify(callable $callback)
    {
        $notify = $this->getNotify();

        if (!$notify->isValid()) {
            throw new FaultException('Invalid request payloads.', 400);
        }

        $notify = $notify->getNotify();

        try {
            $prepayId = call_user_func_array($callback, [$notify->get('product_id'), $notify->get('openid'), $notify]);
            $response = [
                'return_code' => 'SUCCESS',
                'appid'       => $this->merchant->app_id,
                'mch_id'      => $this->merchant->merchant_id,
                'nonce_str'   => uniqid(),
                'prepay_id'   => strval($prepayId),
                'result_code' => 'SUCCESS',
            ];
            $response['sign'] = generate_sign($response, $this->merchant->key);
        } catch (\Exception $e) {
            $response = [
                'return_code'  => 'SUCCESS',
                'return_msg'   => $e->getCode(),
                'result_code'  => 'FAIL',
                'err_code_des' => $e->getMessage(),
            ];
        }

        return new Response(XML::build($response));
    }, def _sheet_asdict(sheet, startstops, usecols=None):
    """
    """

    _, _, start, stop = startstops
    usecols = _sanitize_usecols(usecols)

    if usecols is not None:
        iswithin = start.col <= min(usecols) and stop.col > max(usecols)
        mess = 'Column in usecols outside defined data range, got '
        assert iswithin, mess + str(usecols)
    else:                       # usecols is None.
        usecols = tuple(range(start.col, stop.col))

    # cols = usecols or range(start.col, stop.col)
    D = dict()

    for c in usecols:
        cells = sheet.col(c, start_rowx=start.row, end_rowx=stop.row)
        types = set([cell.ctype for cell in cells])

        # Replace empty values with nan if appropriate:
        if (not types - NANABLE) and xlrd.XL_CELL_NUMBER in types:
            D[c] = np.array([np.nan if cell.value == '' else cell.value
                             for cell in cells])
        elif xlrd.XL_CELL_DATE in types:
            dm = sheet.book.datemode
            vals = []
            for cell in cells:
                if cell.ctype == xlrd.XL_CELL_DATE:
                    dtuple = xlrd.xldate_as_tuple(cell.value, dm)
                    vals.append(datetime.datetime(*dtuple))
                elif cell.ctype in NONABLES:
                    vals.append(None)
                else:
                    vals.append(cell.value)
            D[c] = np.array(vals)
        else:
            vals = [None if cell.ctype in NONABLES else cell.value
                    for cell in cells]
            D[c] = np.array(vals)

    return D, func (o Option) RequiresOption(name string) bool {
	for _, o := range o.Requires {
		if o == name {
			return true
		}
	}

	return false
}, source_sentence: // reBuild partially rebuilds a site given the filesystem events.
// It returns whetever the content source was changed.
// TODO(bep) clean up/rewrite this method.
sentences: func WebPageImageResolver(doc *goquery.Document) ([]candidate, int) {
	imgs := doc.Find("img")

	var candidates []candidate
	significantSurface := 320 * 200
	significantSurfaceCount := 0
	src := ""
	imgs.Each(func(i int, tag *goquery.Selection) {
		var surface int
		src = getImageSrc(tag)
		if src == "" {
			return
		}

		width, _ := tag.Attr("width")
		height, _ := tag.Attr("height")
		if width != "" {
			w, _ := strconv.Atoi(width)
			if height != "" {
				h, _ := strconv.Atoi(height)
				surface = w * h
			} else {
				surface = w
			}
		} else {
			if height != "" {
				surface, _ = strconv.Atoi(height)
			} else {
				surface = 0
			}
		}

		if surface > significantSurface {
			significantSurfaceCount++
		}

		tagscore := score(tag)
		if tagscore >= 0 {
			c := candidate{
				url:     src,
				surface: surface,
				score:   score(tag),
			}
			candidates = append(candidates, c)
		}
	})

	if len(candidates) == 0 {
		return nil, 0
	}

	return candidates, significantSurfaceCount

}, @SuppressWarnings("rawtypes")
	public void open(Map conf, TopologyContext context,
			SpoutOutputCollector collector) {
		if(this.jmsProvider == null){
			throw new IllegalStateException("JMS provider has not been set.");
		}
		if(this.tupleProducer == null){
			throw new IllegalStateException("JMS Tuple Producer has not been set.");
		}
		Integer topologyTimeout = (Integer)conf.get("topology.message.timeout.secs");
		// TODO fine a way to get the default timeout from storm, so we're not hard-coding to 30 seconds (it could change)
		topologyTimeout = topologyTimeout == null ? 30 : topologyTimeout;
		if( (topologyTimeout.intValue() * 1000 )> this.recoveryPeriod){
		    LOG.warn("*** WARNING *** : " +
		    		"Recovery period ("+ this.recoveryPeriod + " ms.) is less then the configured " +
		    		"'topology.message.timeout.secs' of " + topologyTimeout + 
		    		" secs. This could lead to a message replay flood!");
		}
		this.queue = new LinkedBlockingQueue<Message>();
		this.toCommit = new TreeSet<JmsMessageID>();
        this.pendingMessages = new HashMap<JmsMessageID, Message>();
		this.collector = collector;
		try {
			ConnectionFactory cf = this.jmsProvider.connectionFactory();
			Destination dest = this.jmsProvider.destination();
			this.connection = cf.createConnection();
			this.session = connection.createSession(false,
					this.jmsAcknowledgeMode);
			MessageConsumer consumer = session.createConsumer(dest);
			consumer.setMessageListener(this);
			this.connection.start();
			if (this.isDurableSubscription() && this.recoveryPeriod > 0){
			    this.recoveryTimer = new Timer();
			    this.recoveryTimer.scheduleAtFixedRate(new RecoveryTask(), 10, this.recoveryPeriod);
			}
			
		} catch (Exception e) {
			LOG.warn("Error creating JMS connection.", e);
		}

	}, func (s *Site) processPartial(events []fsnotify.Event) (whatChanged, error) {

	events = s.filterFileEvents(events)
	events = s.translateFileEvents(events)

	s.Log.DEBUG.Printf("Rebuild for events %q", events)

	h := s.h

	// First we need to determine what changed

	var (
		sourceChanged       = []fsnotify.Event{}
		sourceReallyChanged = []fsnotify.Event{}
		contentFilesChanged []string
		tmplChanged         = []fsnotify.Event{}
		dataChanged         = []fsnotify.Event{}
		i18nChanged         = []fsnotify.Event{}
		shortcodesChanged   = make(map[string]bool)
		sourceFilesChanged  = make(map[string]bool)

		// prevent spamming the log on changes
		logger = helpers.NewDistinctFeedbackLogger()
	)

	cachePartitions := make([]string, len(events))

	for i, ev := range events {
		cachePartitions[i] = resources.ResourceKeyPartition(ev.Name)

		if s.isContentDirEvent(ev) {
			logger.Println("Source changed", ev)
			sourceChanged = append(sourceChanged, ev)
		}
		if s.isLayoutDirEvent(ev) {
			logger.Println("Template changed", ev)
			tmplChanged = append(tmplChanged, ev)

			if strings.Contains(ev.Name, "shortcodes") {
				shortcode := filepath.Base(ev.Name)
				shortcode = strings.TrimSuffix(shortcode, filepath.Ext(shortcode))
				shortcodesChanged[shortcode] = true
			}
		}
		if s.isDataDirEvent(ev) {
			logger.Println("Data changed", ev)
			dataChanged = append(dataChanged, ev)
		}
		if s.isI18nEvent(ev) {
			logger.Println("i18n changed", ev)
			i18nChanged = append(dataChanged, ev)
		}
	}

	// These in memory resource caches will be rebuilt on demand.
	for _, s := range s.h.Sites {
		s.ResourceSpec.ResourceCache.DeletePartitions(cachePartitions...)
	}

	if len(tmplChanged) > 0 || len(i18nChanged) > 0 {
		sites := s.h.Sites
		first := sites[0]

		s.h.init.Reset()

		// TOD(bep) globals clean
		if err := first.Deps.LoadResources(); err != nil {
			return whatChanged{}, err
		}

		for i := 1; i < len(sites); i++ {
			site := sites[i]
			var err error
			depsCfg := deps.DepsCfg{
				Language:      site.language,
				MediaTypes:    site.mediaTypesConfig,
				OutputFormats: site.outputFormatsConfig,
			}
			site.Deps, err = first.Deps.ForLanguage(depsCfg, func(d *deps.Deps) error {
				d.Site = &site.Info
				return nil
			})
			if err != nil {
				return whatChanged{}, err
			}
		}
	}

	if len(dataChanged) > 0 {
		s.h.init.data.Reset()
	}

	for _, ev := range sourceChanged {
		removed := false

		if ev.Op&fsnotify.Remove == fsnotify.Remove {
			removed = true
		}

		// Some editors (Vim) sometimes issue only a Rename operation when writing an existing file
		// Sometimes a rename operation means that file has been renamed other times it means
		// it's been updated
		if ev.Op&fsnotify.Rename == fsnotify.Rename {
			// If the file is still on disk, it's only been updated, if it's not, it's been moved
			if ex, err := afero.Exists(s.Fs.Source, ev.Name); !ex || err != nil {
				removed = true
			}
		}
		if removed && IsContentFile(ev.Name) {
			h.removePageByFilename(ev.Name)
		}

		sourceReallyChanged = append(sourceReallyChanged, ev)
		sourceFilesChanged[ev.Name] = true
	}

	for shortcode := range shortcodesChanged {
		// There are certain scenarios that, when a shortcode changes,
		// it isn't sufficient to just rerender the already parsed shortcode.
		// One example is if the user adds a new shortcode to the content file first,
		// and then creates the shortcode on the file system.
		// To handle these scenarios, we must do a full reprocessing of the
		// pages that keeps a reference to the changed shortcode.
		pagesWithShortcode := h.findPagesByShortcode(shortcode)
		for _, p := range pagesWithShortcode {
			contentFilesChanged = append(contentFilesChanged, p.File().Filename())
		}
	}

	if len(sourceReallyChanged) > 0 || len(contentFilesChanged) > 0 {
		var filenamesChanged []string
		for _, e := range sourceReallyChanged {
			filenamesChanged = append(filenamesChanged, e.Name)
		}
		if len(contentFilesChanged) > 0 {
			filenamesChanged = append(filenamesChanged, contentFilesChanged...)
		}

		filenamesChanged = helpers.UniqueStrings(filenamesChanged)

		if err := s.readAndProcessContent(filenamesChanged...); err != nil {
			return whatChanged{}, err
		}

	}

	changed := whatChanged{
		source: len(sourceChanged) > 0 || len(shortcodesChanged) > 0,
		other:  len(tmplChanged) > 0 || len(i18nChanged) > 0 || len(dataChanged) > 0,
		files:  sourceFilesChanged,
	}

	return changed, nil

}
pipeline_tag: sentence-similarity
library_name: sentence-transformers
Likes: 0 | All-time downloads: 29
Created: 2025-07-11 05:48:58